Solved

Passing variables with $_Post

Posted on 2014-04-11
8
96 Views
Last Modified: 2014-04-12
I have a page that is getting data from a previous page.  I want to pass the same data to a third page.

I've tried this on the 1st page:
<?php
$work = "?".
                        "Min_Store = ".$Min_Store." ".
                        "Max_Store = ".$Max_Store." ";
?>
<a href =  "Survey_Print.php
      <?php
            echo $work;
      ?>
">   
<br>
                
<input name= "Print" type="button" id="Print" value="<?= $Button_Value; ?>"

Then on the 3rd page, I have:

echo "Min = ";
echo $_GET['Min_Store'];
echo "<br>";
$Min_Store = $_GET['Min_Store'];
$Max_Store = $_GET['Max_Store'];

The URL on the 3rd page looks correct, however I'm not getting the data.
The echo on page 3 just says "Min = ".
What am  I missing.

Glenn
0
Comment
Question by:breeze351
  • 4
  • 4
8 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39995076
The first thing is that there should not be any spaces in a URL, especially in a 'name' for a name/value pair.  Second is that all the values should be urlencoded to prevent them from 'breaking' the URL.  http://us3.php.net/manual/en/function.urlencode.php  Third, each 'name' after the first one needs to be prefixed with an '&' although '&amp;' is considered to be a better choice.

It should end up looking like this:

Survey_Print.php?Min_Store=Min_Store_value&amp;Max_Store=Max_Store_value

Or like this:

Survey_Print.php?Min_Store=123&amp;Max_Store=456
0
 

Author Comment

by:breeze351
ID: 39995181
I changed the code to read:
$work = "?".
                        "Min_Store=".$Min_Store."&;".
                        "Max_Store=".$Max_Store;

The URL is displaying:

http://chris.mrbreeze.net/Survey_Print.php?Min_Store=2000&;Max_Store=3500

The echo is still returning "Min = "

I just tried something and it works.  I changed $_POST to $_GET.

What's up with this?

Glenn
0
 

Author Comment

by:breeze351
ID: 39995242
Min works with the $_GET but Max is returning blank.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39995251
0
 

Author Comment

by:breeze351
ID: 39996460
Ok.
I duplicated the code from your previous post:
Survey_Print.php?Min_Store=123&amp;Max_Store=456

So get rid of that ";" after the "&amp".

Glenn
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39996541
No, you didn't.  Somehow you put an extra ';' in there.  It's either '&' or '&amp;' but Not '&;' and not '&amp;;'.
0
 

Author Closing Comment

by:breeze351
ID: 39996630
Thanks
Glenn
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39996674
You're welcome, glad to help.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question