We help IT Professionals succeed at work.
Get Started

$_GET not passing from form to php script on shared hosting

Last Modified: 2012-05-10
Hi, I have a form which passes values in the url (ie. ?brand_id=1 etc) to a php script which then uses the variables to point to an seo-friendly url/page

It worked perfectly on my local server and other live server but on my clients server in this case it doesn't work and I don't have access to the root (appears to be shared apache settings).

Register globals is set to on so I tried adding stripslashes but this hasn't worked

many thanks experts...

PS. I also tried it with $_POST and $_REQUEST too
//take the posted search criteria and reformat into seo friendly url

$brand_id = mysql_real_escape_string(stripslashes($_GET['brand_id']));
//convert the model variables into a url
$model = mysql_real_escape_string(stripslashes($_GET['model']));
$modelnameurl = urlencode(strtolower($model));    
$modelnameurl_dash = str_replace("+", "-", $modelnameurl);

$prices = mysql_real_escape_string(stripslashes($_GET['prices']));

if($brand_id == 1) {$thebrand = "brand-name-here";}
if($brand_id == 2) {$thebrand = "brand-name-here";}
if($brand_id == 3) {$thebrand = "brand-name-here";}
if($brand_id == 4) {$thebrand = "brand-name-here";}
if($brand_id == 6) {$thebrand = "brand-name-here";}
if($brand_id == 7) {$thebrand = "brand-name-here";}
if($brand_id == 8) {$thebrand = "brand-name-here";}
if($brand_id == 9) {$thebrand = "brand-name-here";}

if($_GET['model'] != '') {$themodelname = '/'.$modelnameurl_dash;};
if($_GET['prices'] != '') {$theprices = '/'.$prices;};

$my_uri = $thebrand.$themodelname.'/'.$brand_id.$theprices;

header( 'Location: /products/'.$my_uri.'' ) ;


Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE