I'm receiving an 'undefined index' error when calling a new window and I can't quite figure out why. Seems to me like the variable is not being passed, or holds no value, and again I can't figure out why. I use an identical code for 'state' with no issues.
Here is the code:
// Here is the initial page where i pass the variable
$state=$_GET['state'];
$sql="SELECT DISTINCT city FROM users WHERE state='$state' GROUP BY city";
$res=mysql_query($sql);
while($r=mysql_fetch_array($res)){
$city=$r['city'];?>
<a href="javascript: void(0)"
onclick="window.open('num_users.php?id=<?=$city?>',
'windowname3',
'width=125, \
height=500, \
directories=no, \
location=no, \
menubar=no, \
resizable=no, \
scrollbars=1, \
status=no, \
toolbar=no,');
return false;">
<?=$city?></a><br />
<? } ?>
// Here is the page where I receive the variable
$city=$_GET['city'];
$sql="SELECT id FROM users WHERE city='$city'";
$res=mysql_query($sql);
$num=mysql_num_rows($res);
echo "".$num." users";
?>
Perhaps I've been staring at this thing for too long. I must be overlooking something simple. Any ideas?