Click to See Complete Forum and Search --> : Add date to field automatic


Peuplarchie
05-27-2007, 08:46 AM
Good day to all,
I would like to add the date and time (30/12/2007 -- 22h00) automaticly to a field and also make that the user can't change it ?


I need "affiche" in the code below to have automaticly the date and time formated like (30/12/2007 -- 22h00) .

Can somebody at least point me to what I should do?



<tr><td bgcolor="#cccc99" width="600" valign="top"><table border="0" align="left" cellspacing="1" cellpading="0" width=600 valign="top">
<tr><td width="600" valign="top" align="left" class="black">
Nom : <input type="text" name="nom"><br>
Date d'affichage : <input type="text" name="affiche"><br>
Courriel : <input type="text" name="courriel"><br>
&Eacute;v&egrave;nement : <input type="text" name="evenement"><br>
Date de l' &eacute;v&egrave;nement : <input type="text" name="date"><br>
Commentaire ou texte :<br>
<textarea name="commentaire" rows="10" cols="60"></textarea><br>

hastx
05-27-2007, 09:33 AM
There are 2 ways to do it:

Have a script run on the form page to pass the date to the submit page in a hidden input. (this isn't good because if the user is on the page for a half hour prior to submitting, you will get an inaccurate time.)
The other way is to append the date to the input on the submission page(which will reflect the actual time of submission):



$date=date('d/m/Y -- H:i');
$affiche=$_POST['affiche'];
$affiche_append="$affiche"."$date";