Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Passing variables with $_Post

Posted on 2014-04-11
8
Medium Priority
?
113 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 84

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

609 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