-1

I'm using sessions to pull data from my one through to a server page that's being called by another index.php page, I do have my session_start(); at the beginning of my pages and my session is being called through a isset by I still get Notice:

Undefined index: reg_number in /var/www/html/portal/techform/server.php on line 75

I can't give all of the coding because it's classified.

I have var_dumped the code and it say's null so for some reason my session doesn't pull the data through to my other page.

Page One: conname is a dropdown so it pulls the value from the dropdown into the session.

$conname = $_POST['conname'];           
$_SESSION['reg_number'] = $conname;
<form method='POST' action='techform/index.php' enctype='multipart/form-data'><button name='updateV' id='updateV' style='width: 300px; height: 50px; font-size:20px;'>View Vehicle Details</button></form>

Server Page: Here $conname is going to be used in a where clause.

if(isset($_POST['updateV']))
{

    $conname = $_SESSION['reg_number']; 
    var_dump($conname);
}

It must give me the value that was selected from the dropdown in the first page.

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Heinie
  • 1
  • 1
  • “Classified” or not - you either present a proper [mre], or there is little we can do for you here. – 04FS Oct 15 '19 at 08:53

1 Answers1

-2

im not sure what ur code looks like, but this can fix the undefined index:

if(isset($_SESSION['reg_number'])){
    $conname = $_SESSION['reg_number']; 
}else{
    die;//or echo an error message for example
}
Ramon de Vries
  • 1,312
  • 7
  • 20