Log in

View Full Version : Show current Data and time on Form field


naseermughal
03-15-2006, 08:23 AM
How can i show the current date and time separately on the form field....

i have a form having the fields username, currentdate, currtime, field4, field5,..

i only want user can enter values in field4 and 5, and first three values are shown automatically....

Can anyone help me in this regards.

Colin F
03-15-2006, 11:44 AM
Use something like this:

<input type="text" value="<?=date('d.M.Y');?>" readonly="readonly" />

naseermughal
03-16-2006, 04:56 AM
Use something like this:

<input type="text" value="<?=date('d.M.Y');?>" readonly="readonly" />

Thanx,

I don't think wether, php tages (<? .... ?>) tags are worked in vb templates. I already try this.

But after that, i create one plugin named show_currdate have following code.

$showdate = date("Y-d-m");

when i call the variable ($showdate) in template it will show the date in format (0000-00-00). Only work on localhost, when i upload this on internet it will show nothing...

Can u help me in this regard.

Colin F
03-16-2006, 05:21 AM
Ah, this is in the templates...

The plugin is the right way to go... try
$showdate = date("Y-d-m", TIMENOW);