ElDiabl
ElDiabl

Reputation: 13

SubPaging Php with if else

I'm having a hard time passing values so here is the code:

These is the code to pass the values($vview is the container of the value) to be used when showing the sub page: from enrollalpha.php

   if(!empty($_POST['Vpanel'])){
             $vview = $_POST['Vpanel'];
             }else {
                 if(!empty($_GET['VPanel'])){                
                 $vview= $_GET['VPanel'];
                }else{
                 $vview= 'VS';
                }
             }

And this is the codes where $vview is to be used

if($vview == 'VS'){
            require_once 'vpanel_student.php';
        }
        else if($vview == 'VA'){
            require_once 'vpanel_adviser.php';
        }
        else if($vview == 'VA'){
            require_once 'vpanel_adviser.php';
        }else{
            require_once 'vpanel_student.php';
        }

let us assume my subpage now is showing vpanel_adviser.php at the said page i have this code:

    else if(empty($_GET['id'])){
               header("location:enrollalpha.php?&VPanel='VA'");

            }

So at enrollalpha.php remember i have this

    if(!empty($_GET['VPanel'])){                 
             $vview= $_GET['VPanel'];
            }else{
             $vview= 'VS';
            }

my current problem is when vpanel_adviser.php returns the user to enrollalpha.php it is not showing vpanel_adviser.php but shows vpanel_student.php Would appreciate any help on this.

Upvotes: 1

Views: 50

Answers (1)

Starx
Starx

Reputation: 78991

You dont need to quote the value in the URL and unneeded "&" in the URI string.

header("location:enrollalpha.php?&VPanel='VA'");
                              // ^   &   ^ Here

Change to

header("location:enrollalpha.php?VPanel=VA");

Upvotes: 2

Related Questions