By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,775 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,775 IT Pros & Developers. It's quick & easy.

PHP Date problem

P: n/a
On our companies website have have several pages that submit to a
database that php provides the date automatically. One page, however,
will not. This page is generated by a database search and have 5 fields
that are added and then updated in the database. One of these fields is
the date.

<INPUT NAME="daterepaired" TYPE="text" VALUE="<?php echo date("M d,
Y")" ?>; SIZE="15">

This doesn't work. It displays a box with <?php echo date( in it. I
have tried replacing " with ' with no difference. I'm beginning to
think that it is because the page this is on is generated from a php
search script. This code works for me on the other pages. Anyone have
any suggestions or alternatives?

Thanks for your help,

Greg

Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Greg wrote:
<INPUT NAME="daterepaired" TYPE="text" VALUE="<?php echo date("M d,
Y")" ?>; SIZE="15">


Switch the semi-colon with the double-quote before it.

--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #2

P: n/a
Greg wrote:
<INPUT NAME="daterepaired" TYPE="text" VALUE="<?php echo date("M d,
Y")" ?>; SIZE="15">

This doesn't work. It displays a box with <?php echo date( in it.


sounds like the file isn't PHP parsed.

--
Jock
Jul 17 '05 #3

P: n/a
Sorry, typo on my part. Below is how it is on the site.

<input name="daterepaired" type="text" value="<?php echo date("M d,
Y");?>" size="15">

Would the fact that the page this is on being generated by a script
have any effect on it?

Thanks,

Greg

Jul 17 '05 #4

P: n/a
On 2 Jun 2005 16:36:48 -0700, Greg wrote:
Would the fact that the page this is on being generated by a script
have any effect on it?


Sure. The script generates output, which is sent to the browser. The
output is not magically scanned for php tags first. Instead of
outputting php code from the script, output what the php code would.
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #5

P: n/a
if your html line is actually generated by php (as you hint) than it
should look like this

print '<input name="daterepaired" type="text" value="'.date("M d,
Y").'" size="15">';

result in the browser:
<input name="daterepaired" type="text" value="Jun 03, 2005" size="15">

micha

Jul 17 '05 #6

P: n/a
This did the trick. Thanks for your help.

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.