Page 1 of 1

Passing Values With Forms

Posted: Mon Feb 08, 2010 8:37 pm
by JackD
Is there a way to pass the value of a variable in $_POST? I have tried the following code:

$Pickup=4;
...
<form>
....
<input type=hidden name="OT" value=intval($Pickup)>
</form>

However, $_POST['OT'] is passed as "intval(\$Pickup". If I change the line to be:

<input type=hidden name="OT" value="$Pickup">

it passes "\$Pickup". If I leave off the double quotes, it passes the same value. Is there a way so it will pass the value 4?

Re: Passing Values With Forms

Posted: Tue Feb 09, 2010 1:05 am
by Christopher

Code: Select all

<?php
$Pickup=4;
?>
<form action="mypage.php" method="post">
<input type=hidden name="OT" value="<?php echo intval($Pickup); ?>">
</form>

Re: Passing Values With Forms

Posted: Tue Feb 09, 2010 8:33 am
by JackD
Thanks.... I knew there was something I was missing.