Pulling in current date and time?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I would like to populate the date text box on my html form with the
current date and time. here is what I have now:

How could I update this to automatically display the date and time in
this editorialdate field? I want it to be formatted correctly for
mySql DATETIME field.

<TITLE>Daily Production Report / Editorial</TITLE>
<form method="POST" action="editorial-report.php">
<p><img src="http://pooch/assets/ETN_intranet_r2_c2.jpg"></p>
Please enter report data and press the <b>SUBMIT</b> button
<input type="text" name="editorialDate" size="15" maxlength="25">


Re: Pulling in current date and time?

paul814@excite.com wrote in news:1193759131.795457.106780

Quoted text here. Click to load it

You can start by reading a book, tutorial or the PHP online manual which  
offers great assistance.

People of this newsgroup generously offer their time to assist people with  
PHP problems.... they don't do your homework, projects, or anything else  
that you personally need 'done'.


Re: Pulling in current date and time?

I can get the date to show up...thats not the issue.
to get the current date I do this:
echo date("Y-m-d h:i:s", time());
And the current date is displayed.

I want to get that current date in the value of my textbox named
editorialdate so that it is auto filled in on load of page.

If I try to surround this:


<input type="text" name="editorialDate" size="20" maxlength="25">

in <?php  tags I get an error on the page.  So I just want to make the
value of the textbox be equal to what I can already display on the

Quoted text here. Click to load it

Re: Pulling in current date and time?

paul814@excite.com wrote in

- top posting fixed -

Quoted text here. Click to load it

Are you familiar with how to echo/print PHP variables to HTML?  You  
should be.

$theDate = date("Y-m-d h:i:s", time());

... then all your form stuff (OUTSIDE THE PHP!!)

... with your input like:

<input type="text" name="editorialDate" value="<?php echo $theDate; ?>">

... you should do a PHP tutorial or something, it's hard to get more  
basic than this.

Site Timeline