Page 1 of 1

$_POST not working in next 2 pages ?

Posted: Tue Feb 05, 2008 4:08 pm
by ashebrian
I'm still learning php. I've got a page where i post info taken from the first page to the next .... like:

Code: Select all

<?php echo $_POST["price"]; ?>
. That works fine....BUt when i use the same code again for the page after that it doesn't seem to come up at all.....just blank. I persume that the variable

Code: Select all

$_POST
only works once, but u can't post it again using the same code.

Does anybody know a solution to this? Or will i have to setup a table in the db to call the info to the next page?

Re: $_POST not working in next 2 pages ?

Posted: Tue Feb 05, 2008 5:02 pm
by Christopher
You need to put the price into a hidden field on each page like:

Code: Select all

<input type="hidden" name="price" value="<?php echo intval($_POST['price']); ?>"/>

Re: $_POST not working in next 2 pages ?

Posted: Tue Feb 05, 2008 5:06 pm
by Zoxive
Post only works on the file/page you submit the form to.

A solution would be using $_GET, or $_SESSION.