PDA

View Full Version : Link not passing variables PHP



imagined
February 9th, 2005, 05:59 PM
This is part of the script:


while($groupListRow = mysql_fetch_array($groupListResult))
{
$groupId = $groupListRow["id"];
$list = $groupListRow["groupName"];
echo("<li>" . $list . " - <a href='EDIT_group.php?id=$groupId&groupName=$list'>Edit</a></li>");
}


This is what comes out on the address bar after clicking the link:
http://localhost/troubleticket/EDIT_group.php?id=1&groupName=Accounting

This EDIT_group.php where it should go.


echo ($id);
echo ($groupName);


Why doesn't it print? The variables show on the address bar! What am I doing wrong? :h:

RushScripting
February 9th, 2005, 09:08 PM
REGISTERED GLOBALS are probably not turned on. Change the $id to $_GET['id'] and you should get it. There is also some php code you could put at the beginning of your script that will give you your variables' values.



if (!ini_get("register_globals")){
foreach ($_REQUEST as $k=>$v){
if (!isset($GLOBALS[$k])){
${$k}=$v;
}
}
}


HOPE THIS HELPS :D