NashvilEric Posted August 25, 2007 Share Posted August 25, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/66672-solved-_get-variable-trouble/ Share on other sites More sharing options...
NashvilEric Posted August 25, 2007 Author Share Posted August 25, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66672-solved-_get-variable-trouble/#findComment-334058 Share on other sites More sharing options...
samoht Posted August 25, 2007 Share Posted August 25, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/66672-solved-_get-variable-trouble/#findComment-334064 Share on other sites More sharing options...
NashvilEric Posted August 25, 2007 Author Share Posted August 25, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/66672-solved-_get-variable-trouble/#findComment-334089 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.