RE: argh! still not able to get my variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shiloh,

I'm kind of a latecomer here, but on my system, this works:

<?

if(isset($county_id)) {
    print "<p>COUNTY ID: $county_id<br>\n";
} else {
}   print "No County ID<br>\n";

?>

<p>
<a href="<?= $PHP_SELF ?>?county_id=17089">17089</a><br>
<a href="<?= $PHP_SELF ?>?county_id=99999">99999</a>

Can't think why you wouldn't be able to access that value unless you're
accidently clearing it before checking it. If you're trying to access
$county_id from inside a function, though, you'll need to declare it as a
global so the function won't think you're referencing a local variable by
the same name, i.e.

function process_submit() {

	global $county_id;

	print "ID: $county_id<br>\n";

}

> -----Original Message-----
> From: Shiloh Madsen [mailto:shiloh_madsen@nsc-support.com]
> Sent: Friday, October 10, 2003 5:58 PM
> To: php-db@lists.php.net
> Subject:  argh! still not able to get my variables
> 
> 
> First off, thank you to all the people who have helped me so 
> far with passing variables in a URL. I THINK it worked, but 
> it would appear not to have. 
> 
> this is the line in the page with the link:
> 
> <a href='detail.php?county_id=$county_id'>$name</a>
> 
> So what this should do is make the line item be a hyperlink 
> to a detail page for the county. When i click the link, the 
> address shows up as: 
> 
> http://cis1.elgin.edu/cis21020/detail.php?county_id=17089
> 
> so it appears to be passing the information. 
> 
> The thing is, i cant refrence that variable...maybe in doing 
> it wrong, but i dont know. 
> 
> Ive tried echoing $county_id and nothing shows up. Someone 
> else suggested that i put var_dump($_GET);
> into the page to see if it shows up in the variable list. 
> When i insert this line, the page only says NULL. What in the 
> world am I doing wrong?
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux