Link to home
Start Free TrialLog in
Avatar of jimgordon
jimgordon

asked on

Undefined index

I get this error when I open the page where you can choose a city to post an ad. Error seems to be in the second line of the code:
$targetview = $_GET['targetview'];
$citylink_view = "view=$targetview&postevent=$_GET[postevent]";
//$citylink_view = "view=selectcity&targetview=$targetview";
 
if($location_sort) 
{
	$sort1 = "ORDER BY countryname";
	$sort2 = "ORDER BY cityname";
}
else
{
	$sort1 = "ORDER BY c.pos";
	$sort2 = "ORDER BY ct.pos";
}

Open in new window

Avatar of jimgordon
jimgordon

ASKER

I changed into:

$postevent = isset($_GET['postevent']);
$targetview = $_GET['targetview'];
$citylink_view = "view=$targetview&postevent=$postevent";

and it works now. It is correct?
Yes
 in you previous statement you forgot the single quote around the postevent

$citylink_view = "view=$targetview&postevent=$_GET['postevent']";
ASKER CERTIFIED SOLUTION
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial