Field default value

Reply

Join Date: Feb 2005
Posts: 20
Reputation: Stick is an unknown quantity at this point 
Solved Threads: 0
Stick Stick is offline Offline
Newbie Poster

Field default value

 
0
  #1
Jun 21st, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: Field default value

 
0
  #2
Jun 21st, 2005
[PHP]
<?php
$script_dt = date('Y-m-d'); //Modify formatting for your needs.
?>
<input type="text" name="userdate" value="<?= $script_dt ?>" />
[/PHP]

See http://us2.php.net/manual/en/function.date.php for more about date formatting.
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 20
Reputation: Stick is an unknown quantity at this point 
Solved Threads: 0
Stick Stick is offline Offline
Newbie Poster

Re: Field default value

 
0
  #3
Jun 23rd, 2005
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC