Jump to content

Simple Question


Munas
 Share

Recommended Posts

Guys, I am a complete newb and can't figure this out. Basically, I need to take the following line:<INPUT name="startdate" value="20041125" type="hidden"> And make it so it enters the current date into the value field. It must be in the yyyymmdd format.Again, I am sorry for asking such a basic question. Any help is appreciated.

Link to comment
Share on other sites

Im assuming that since your posting this in the php forum, that your form is based inside a php page. If so, then the answer has two possibilities. a) You can insert the date on the form side of the page, or:) Insert the date on the submitted side of the form (page that the form sends you to).Either way the code will look like this:$today = date("Ymd"); Which will output it like 20060405If you want to add slashes to it you can do:$today = date("Y/m/d"); Now if you are going to put it on the form page then all you do is this:<INPUT name=startdate value=$today type=hidden> Assuming your form is in the <? ?>, but if its not then it will look like this:<INPUT name=startdate value=<?=$today;?> type=hidden>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...