Passing Variables From One Page To Another

allthat

Free Member
Oct 2, 2012
31
0
Hi Guys,

I have created / am creating an order form in Php, I have not tested the output yet, but, as i'm a novice programmer, I would like some heads up on as how to make the following snippet of my code 'Hidden'.

I have other form input data that i'm quite confident will be 'Hidden' on the output page ...if you get my drift!

PHP:
if($_POST['choosevar'] == length ) {
$myvar = $_POST['INPUT'];
}
if($_POST['choosevar'] == height ) {
$myvar = $_POST['INPUT'];
}
if($_POST['choosevar'] == width ) {
$myvar = $_POST['INPUT'];
}
if($_POST['choosevar'] == weight ) {
$myvar = $_POST['INPUT'];
}
 
How would I go about making the above 'Hidden' output (the resulting data from this page: length, height, width, weight, then goes on to another page, for example Thank You page.
 
I do hope you know what I mean, any help greatly appreciated.
 
Thanks Steve, but would it be hidden???
I'm not altogether sure what you are trying to achieve, but unlike "get", "post" variables between pages on your server are not visible in the URL so are hidden (apart from if you look at the html source of the posting page).

As long as the php doesn't somehow output the variable contents to the page, there's not reason it should be visible.

Steve
 
  • Like
Reactions: allthat
Upvote 0
Steve, thanks for your replies and changes that I will implement.

What i'm trying to do is:

Page 1 (html)
customer fills out form, address, phone number, selects length, etc.

Page 2 (php)
collects data from page 1. Customer also enters email on this page. All the customer sees is: Enter email and an input box for email address. The data from Page 1 is at this point 'Hidden'.

Page 3 (php)
collects 'Hidden' data from page 1 and 'Hidden' data from page 2. This page then goes off to Paypal for payment and I get resulting data to my email.

I think I have all the code for hidden inputs, but am not so sure about how to go about the select / dropdowns in terms of them being hidden, ie: length and then you select 1cm, 2cm, 3cm etc. height and then you select 1cm, 2cm, 3cm you get the idea!

Thanks.
 
Upvote 0
O.k, so maybe I made my question more difficult than it should have been!

Perhaps what I should have asked, is......

.... Does anyone know how to create a dropdown select and then pass the variables between mutiple pages with Php to be 'Hidden' until the last page?
 
Upvote 0
O.k, so maybe I made my question more difficult than it should have been!

Perhaps what I should have asked, is......

.... Does anyone know how to create a dropdown select and then pass the variables between mutiple pages with Php to be 'Hidden' until the last page?
ok, if you are using the post method, the "hidden" data you would be posting using hidden fields would be visible to anyone viewing the page source.

The best way to achieve what you want to do is to use POST on any NEW data from a page (eg that requires user input), and when simply passing the variables from one page to another, use session variables which are hidden.

Steve
 
Upvote 0
ok, if you are using the post method, the "hidden" data you would be posting using hidden fields would be visible to anyone viewing the page source.

The best way to achieve what you want to do is to use POST on any NEW data from a page (eg that requires user input), and when simply passing the variables from one page to another, use session variables which are hidden.

Steve

So with your first reply, the output will be visible, using session variables won't, if I'm correct. But with session variables will I get the selected output, lenghth, width etc?

Ta.
 
Upvote 0
So with your first reply, the output will be visible, using session variables won't, if I'm correct. But with session variables will I get the selected output, lenghth, width etc?

Ta.
Yes, session variables don't need to be "posted" in the HTML from one page to another - you can keep the code that stores them within the PHP. With a POST method, you have to use hidden form fields which would be visible in the page's html code.
 
  • Like
Reactions: allthat
Upvote 0

Latest Articles