Guest Posted November 14, 2012 Share Posted November 14, 2012 I have a form with a field for users to type in the current date. My question is, is there any way for me to have the current date to automatically populate in this field? Here's the code I am using: <tr> <td><b>Date Assigned (YYYY-MM-DD):</b> <br /><input type="text" name="date_assign" size="25" /><br /> </tr> If I could get todays date to automatically pop in this that would be great! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/270700-php-date-code-help-needed/ Share on other sites More sharing options...
Scott_S Posted November 14, 2012 Share Posted November 14, 2012 look at input's value attribute Quote Link to comment https://forums.phpfreaks.com/topic/270700-php-date-code-help-needed/#findComment-1392457 Share on other sites More sharing options...
Manixat Posted November 14, 2012 Share Posted November 14, 2012 <input type="text" name="date_assign" size="25" value="<?php echo date('Y-m-d',time()); ?>"/> Quote Link to comment https://forums.phpfreaks.com/topic/270700-php-date-code-help-needed/#findComment-1392459 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.