PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
quadoc
Forum Contributor
Posts: 137 Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA
Post
by quadoc » Mon Aug 08, 2005 10:59 am
I've the following codes, it keep giving error - Notice: Undefined index: order in c:\Inetpub\wwwroot\schoolProject\admin\show.php on line 179. Can someone tells me why? Thanks...
Code: Select all
/******************* collect sort order (ASC/ DESC)*********************/
$i_order = $_GET["order"]; / line 179
if($i_order == "")
{
$i_order = $_POST["order"];
}
/////////////
if($i_order == "")
{
$i_order = 1;
$s_sortorder = " DESC ";
}
else if($i_order == 1)
{
$i_order = 0;
$s_sortorder = " DESC ";
}
else if($i_order == 0)
{
$i_order = 1;
$s_sortorder = " ASC ";
}
//$i_col = $_GET["col"];
/************** collect coloumn no*******************/
$i_col = $_GET["col"];
if($i_col == "")
{
$i_col = $_POST["col"];
}
if($i_col == "")
{
$i_col = 3;
}
/*********************Switch case statement******************/
switch($i_col)
{
case 0 :
$s_sort = " order by pir ".$s_sortorder;
break;
case 1 :
$s_sort = " order by email ".$s_sortorder;
break;
case 2 :
$s_sort = " order by categories ".$s_sortorder;
break;
case 3 :
$s_sort = " order by date_request ".$s_sortorder;
break;
case 4 :
$s_sort = " order by ID ".$s_sortorder;
break;
case 5 :
$s_sort_assgn = 1;
break;
case 6 :
$s_sort = " order by open ".$s_sortorder;
break;
}
?>
<input type= "hidden" name = "order" value = "<?=$i_order?>">
<input type= "hidden" name = "col" value = "<?=$i_col?>">
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Mon Aug 08, 2005 11:19 am
Are you always able to get output by using
<?=$variable?> ?
Is IIS parsing
<?=?> ?
What happens when you replace the code with echo ?
Code: Select all
<input type= "hidden" name = "order" value = "<? echo $i_order; ?>">
<input type= "hidden" name = "col" value = "<? echo $i_col; ?>">
skhale
Forum Newbie
Posts: 6 Joined: Sat Aug 06, 2005 12:56 pm
Location: Boston, MA
Post
by skhale » Mon Aug 08, 2005 12:06 pm
The error is coming from no variable named order being set in $_GET (query string)
You could check for it not being set, that would prevent the error:
Code: Select all
$i_order = (isSet($_GET['order'])) ? $_GET['order'] : null;
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Aug 08, 2005 12:21 pm
mutliple threads for the same issue: not cool.
viewtopic.php?t=36619
thread locked.