Re: Date field in HTML form
I propose to fill forms to my clients, who will then feed a mysql database, but how to have the date of registration include it?
Is there a miracle function like:
Code:
<Input type = "hidden" name = "date" value = "date???"
I could insert into my form? Thank you all for your help.
Re: Date field in HTML form
Why do not you put the date in. via PHP ? because you'd have javascript turned off. So you do something like
Code:
<Input type = "hidden" name = "date" value = "<? Today's date in PHP?>"
Re: Date field in HTML form
I injected the code:
<Input type = "hidden" name = "date" value = "<? Php echo date (" cmd");?>">
and everything is OK. In one form, I create a list box to the customer inserts his city. Here's the code:
Code:
<select name="vl" id="vl">
<option> Choose ...</ option>
<option value="vl1"> town1 </ option>
<option value="vl2"> vl2 </ option>
<option value="vl3"> vl3 </ option> (etc. ..)
</ Select>
But if the city of the customer is not in this list, I asked him to return the input directly by the function:
Code:
<input type="text" name="vl" id="vl">
If the user enters the names of his city by the function input is OK, but if he selects a city from the dropdown list, it is automatically deleted by the function input that follows, and in which n has not returned. What to do? In any case thank you 1000 times for once the date (it's true that I had to post it in php, both for me).
Re: Date field in HTML form
You put two fields cities:
Code:
you select your call tw1
and your input vl2
PHP and you tested:
Code:
if tw1 = name
then vlchoice = vl2
otherwise vlchoice = tw1
It's not hard to make a php IF statement.
Re: Date field in HTML form
This is the code you are looking for
Code:
<form action="" method="post">
<p>
Choose your city:
<select name="chx1" id="chx1">
<option value=""> Select </ option>
<option value="vl1"> town1 </ option>
<option value="vl2"> vl2 </ option>
<option value="vl3"> vl3 </ option>
</ Select>
</ P>
<p> or enter the name of your city:
<input type="text" name="chx2" id="chx2">
</ P>
<p>
<input type="submit" name="submit" value="Envoyer">
</ P>
</ p>
</ p>
<Php
$ d = $ _POST ['chx1'];
$ d2 = $ _POST ['chx2'];
if ($ d == "")
(
?>
<Input type = "hidden" name = "city" value = "<? Echo $ d2;?>">
<?
echo $ d1;
echo $ d2;
)
?>
</ Form>
Re: Date field in HTML form
The problem is that I must submiter TWICE before having the correct value (the correct name of town) in the variable $ Resu-that's a bit messy ... It should be something that "pre-valid" variables and choix1 choix2; I Potash my big books, and I found the "OnBlur" but I know the syntax ... What do you think?