Page 1 of 1

Inserting date automatically into a from field?

Posted: Sat Jul 03, 2004 1:00 pm
by dysonline
I'm sure this is really simple but can't manage to do it. I want to insert the date automatically into a form field so the user doesn't have to type it themselves. Please help!

Posted: Sat Jul 03, 2004 1:05 pm
by tim

Code: Select all

<?php

$date = date("l, F d, Y");

echo "<form action="page.php" method="POST">";
echo "<text input=text value="$date" name=blah>";
etc etc


?>
modfiy the $date var to whatever format you want. the thing you want is value= in your form, assign it the date var.

kudos

Posted: Sat Jul 03, 2004 1:06 pm
by andylyon87
There is a date function in php where different letters stand for different things:
eg
date(M);
would show jun

if you go on http://www.php.net and search date it should tell you the other options