Reputation: 21
Is this correct if I'm trying to get a date value inside an input box?
When running the page, I get <?=$todate?>
inside the box instead of the actual date.
$todate=$_REQUEST['todate'];
That is how I am requesting the $todate
variable.
Upvotes: 0
Views: 98
Reputation:
I guess you embedded PHP in an .html file. Copy your code into a .php file (e.g. test.php), start your webserver (e.g. apache in xampp) and call your script via URL in browser:
http://localhost/test.php?todate=12.02.1980
PHP-Code:
<?php
if(isset($_REQUEST['todate']))
$todate = $_REQUEST['todate'];
else
$todate = null;
?>
HTML:
<form name="myForm">
<input type="text" value="<?=$todate; ?>">
</form>
Upvotes: 0
Reputation: 2784
Either turn on short tags in your php.ini file, or convert your code to <?php echo $var;?>
... and make sure your page is being parsed as PHP
Upvotes: 2