Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Monday morning php stutter.....

Monday morning php stutter.....
Thread Tools
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Jun 27, 2005, 02:52 AM
 
So if I have a url main.php?res=2 with this code in it

Code:
<? //$res = 3; echo "res =".$res; ?>
Why can't I see the variable? (I want to see "res = 2")

(If I uncomment out the second line in the code above I do get the result "res = 3")

:/
(Last edited by skalie; Jun 27, 2005 at 03:02 AM. )
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 27, 2005, 03:47 AM
 
Do you mean something like this?


[php]
<?
// thisFile.php?someVar=123

$someVar= $_GET['someVar'];
if (!$someVar) {
die("<p>You didn't specify someVar</p>");
}

$stringOut = "You passed ($someVar) as a value via the URL";
echo ($stringOut);
?>
[/php]
     
skalie  (op)
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Jun 27, 2005, 03:51 AM
 
Yep, had just found it, many thanks though.

Code:
echo "res = ".$_GET['res'];
Has to do with global variables being off it appears, but I can't remember encountering the need for that syntax before.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:18 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2