Jump to content

[SOLVED] _GET variable trouble


NashvilEric

Recommended Posts

I have a script that builds images out of text. It is called like this:

 

<img src="../phpScripts/replaceText.php?text=The Kammholz Law Firm&style=homeTitle&color=<?php echo $sectionColor ?>" alt="The Kammholz Law Firm"/>

 

So it needs to pass three variables to the script: 'text,' 'style,' and 'color.'

 

The script reads them like this:

 

$text = $_GET['text'] ;
$style = $_GET['style'] ;
$color = $_GET['color'] ;

 

Which seems right to me. And, in fact, it works in a different section of the page just fine:

 

<img src="../phpScripts/replaceText.php?text=How We Started&style=subTitle&color=<?php echo $sectionColor ?>" alt="How We Started"/>

 

The trouble is that the top example doesn't pass the $color variable to the script. For some reason, the _GET doesn't get anything from it at all! Is there a limit to the number of variables I can _GET? if so, why do 3 variables work sometimes but not other times on the same script?

 

I've been stuck on this for two days. Any help would be very much appreciated!

Link to comment
Share on other sites

This is inexplicable. It's gone back to only ready the 'text' and the 'style' variable, and not the color, for any of them. I haven't changed any code.

 

Why would it sometimes not read the third variable? Server timeout issue? Some kind of unresolved loop? I'm still stuck.

 

www.kammholzlaw.com, if you would like to see. It only renders in Firefox right now. The large print title and the smaller print subtitles are what I'm trying to generate dynamically.

Link to comment
Share on other sites

you haven't shown us any loop, and it would be nice to see where you're setting the $sectionColor

 

Is it possible that $sectionColor is NULL?

 

As far as I know there is no limit to the number of $_GET variables. But if you just want to set certain colors an styles that are predefined  - why do you need to $_GET them? 

Link to comment
Share on other sites

Here's where I'm setting the section color. Just one now, but there will be one per section:

$section = $_GET['id'] ;
switch ($section) {
case 'values':
$pageTitle		= 'Our Values';
break;
case 'practiceAreas':
$pageTitle		= 'Our Practice Areas';
break;
case 'people':
$pageTitle		= 'Our People';
break;
case 'results':
$pageTitle		= 'Our Results';
break;
case 'community':
$pageTitle		= 'Our Community';
break;
case 'contactUs':
$pageTitle		= 'Contact Us';
break;
default:
$section				= 'home';
$pageTitle		= 'Welcome';
$sectionColor	= '2F3649';
}
?>

 

I've solved the problem, though. Turns out you can't pass a '#' symbol through a URL/$_GET system. So I'm now just passing the numbers and adding the '#' when it gets to the processing script.

 

Thanks for all the help ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.