0

<?php

$system_date = Date(m/d/Y);

<input type = "Date" value = <? echo $system_date; ?>

?>

I want to set system date to above date box.But this will not work.If I change type to text then it will work as I want.What is the problem here.How can I set system date to text box which type is Date.Please help me.If there is any other way to do the same thing please let me know.

Thanks.

3
Contributors
5
Replies
26
Views
4 Years
Discussion Span
Last Post by cmps
0

I didn't really understand what you want.
But you have lot of errors in this php code:

<?php

$system_date = Date("m/d/Y");

echo '<input type = "Date" value ="' . $system_date . '">';

?>
0

There is no such thing as a date input type unless your developing with HTML5.

Your code needs to be:

<?php
$system_date = Date('m/d/Y');
?>

<input type = "text" value ="<?php echo $system_date; ?>">

The date method in PHP has single or double quotes, since it is a defined function.

Edited by Banderson

0

@cmps Yes input date is a new type defined in HTML5. Actually pretty handy.
To bad it doesn't work in older browsers(eg: IE 8) and 9 as features are limited. HTML5 is great for the upcoming web however.

Edited by Banderson

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.