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.
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;
}
ASKER
I attach the file. For this issue, we are on line 509.
Did you try this:
elseif (( isset($_GET['subcatid']) || isset($_GET['postevent'])) && ( isset($xcityid) && $xcityid > 0))
elseif (( isset($_GET['subcatid']) || isset($_GET['postevent']))
ASKER
This is the entire file. Go to line 509.
post.txt
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.
you need to make it a text file first, or just copy and paste the code into the code snippet box.
ASKER
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.
It's going to take some time to fix.
ASKER
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.
$_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?
ASKER
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[c ityid]&sub catid=$_GE T[subcatid ]"; else echo "index.php?$qs"; ?>" method="post" name="frmPost" enctype="multipart/form-da ta">
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.
<form action="<?php if($in_admin) echo "postad.php?cityid=$_GET[c
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.
ASKER
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.
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.
ASKER
Tell me if you need more code, other files. Thanks a lot, you are very kind.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Cosimo.
email me
kefka1911@gmail.com
kefka1911@gmail.com
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.