954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Field default value

Hello All,
I have a form that I created for user login.
It has three fields.
username
Password
Date
I want the date field to default to the current date when users login.
Can anyone help me with setting a default value for the date field?
Thanks in Advance!

Stick

Stick
Newbie Poster
20 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

[PHP]
<?php
$script_dt = date('Y-m-d'); //Modify formatting for your needs.
?>

[/PHP]

See http://us2.php.net/manual/en/function.date.php for more about date formatting.

Troy
Posting Whiz
362 posts since Jun 2005
Reputation Points: 36
Solved Threads: 6
 

Troy,
Thanks for your help. It worked great. I ended up getting rid of the date field all together, and sending the script_dt variable directly to the table. So now when someone logs in I can see the date and time.
Thanks again for your help!
Stick

Stick
Newbie Poster
20 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You