Hello Alex,
On 11 Mar 2004 at 10:15, Alex Hogan wrote:
> if(empty($_SESSION['sellocation'])){
>
> $_SESSION['selloction'] = '0';
Have a close look at the array member above. It's spelled differently from the others
(an
A is missing).
>
> }
>
> $_SESSION['sellocation'] = $_POST['sellocation'];
>
>
> if($_SESSION['sellocation'] == '0'){
>
> $errormsg = true;
>
> ?>
>
> <script>
>
> redirect('cf_survey.php?cf=0');
>
> </script>
>
> <?
>
> }
>
>
>
> [snip]....
>
>
>
> <a href="cf_survey.php?cf=1&q1=1">
>
>
>
> This seems to be where I run into trouble.
>
>
>
> When the user selects the main question choice and the page reloads I get an
> error that the index 'sellocation' is not set.
>
>
>
> If I change the expression to something like this;
>
>
>
> if(empty($_SESSION['sellocation'])){
>
> $_SESSION['selloction'] = '0';
>
> }
>
> else{
>
> $_SESSION['sellocation'] = $_POST['sellocation'];
>
>
> if($_SESSION['sellocation'] == '0'){
>
> $errormsg = true;
>
> ?>
>
> <script>
>
> redirect('cf_survey.php?cf=0');
>
> </script>
>
> <?
>
> }
>
>
>
> I loose the redirect on the drop down.
>
>
>
> What am I missing?
I'm having trouble understanding how your application works. For starters, I don't see
where $POST['sellocation'] is being set, because you didn't provide us with that part
of
the code. It's true that, as it didn't make immediate sense to me, I didn't bother
reading
the code again because I don't have much time.
A couple of things off the top of my head that may or may not be related to your
problem: (a) if you're using any values sent via the URL string (e.g. cf=0), you need
to
use $_GET, not $_POST; (b) empty() will also evaluate to true if the value of the
variable
is zero.
Good luck,
Erik