Link to home
Start Free TrialLog in
Avatar of jimgordon
jimgordon

asked on

Undefined Index - isset() doesn't fix it

I get this undefined index notice when I access the page where to choose the category in which to post a classified ad in my script.

Error is in the first line of the snippet. I have tried to surround the $_GET['postevent'] with an isset(), it makes the notice disappear, but then script doesn't work properly. There must be another solution.
elseif (($_GET['subcatid'] || $_GET['postevent']) && $xcityid > 0)
{
	// Show the form //
 
	if($_GET['subcatid'] == -1)
	{
		$_GET['postevent'] = $_REQUEST['postevent'] = 1;
	}

Open in new window

Avatar of nplib
nplib
Flag of Canada image

this is why initially I said, put every thing in variables, then use.

but instead of posting the code you went ahead and accepted that other guys answer.

Which did exactly what you didn't want.

Solve one, to break another.

so post, code, and we can put an end to this.
Avatar of jimgordon
jimgordon

ASKER

I attach the file. For this issue, we are on line 509.
Avatar of hielo
Did you try this:
elseif (( isset($_GET['subcatid']) || isset($_GET['postevent'])) && ( isset($xcityid) && $xcityid > 0))
This is the entire file. Go to line 509.
post.txt
it didn't get attached.

you need to make it a text file first, or just copy and paste the code into the code snippet box.
Dear hielo, I tried it now. It doesn't work. It makes the notice disappear, but it makes script work not properly: That is, if I select a city, then I cannot select the category and I directly enter the form to insert an ad in a category i do not have chosen.
there are tons of errors in this script.

It's going to take some time to fix.
You think there will be a solution or should I close this question?
why do you mix
$_POST
$_GET
$_RESULT

There are times that it makes sense to mix, but not often, but the use of $_RESULT covers both post and get, so I don't understand why it's thrown in the mix.
if your form using post or get?
it uses post, I guess: so you can see in the attached file at line 614:

<form action="<?php if($in_admin) echo "postad.php?cityid=$_GET[cityid]&subcatid=$_GET[subcatid]"; else echo "index.php?$qs"; ?>" method="post" name="frmPost" enctype="multipart/form-data">

I think is this the form we are dealing with...
Sorry but I'm not the developer of the script. I am trying to fix it.
nplip: should I change every POST and GET in the file with RESULT?
it's not as simple as just change the posts and gets, I just need to know so I can fix it.
and judging by your form, it uses both. but you don't need $_RESULT in this case, because you have a specific need for $_GET and one for $_POST

give me some time.

I'll get back to you.
Tell me if you need more code, other files. Thanks a lot, you are very kind.
ASKER CERTIFIED SOLUTION
Avatar of nplib
nplib
Flag of Canada 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
I thank you and I accept as a solution your suggestions. I would like to let you see my entire script and ask you for a quote, since I really desire to fix it. Tell me if you can. Otherwise... thanks a lot again.

Cosimo.
email me
kefka1911@gmail.com