Jump to content

[SOLVED] $_POST['select'] NULL help


Thundarfoot

Recommended Posts

I have a problem with adding page navigation to my script.

 

My problem is when the user clicks the navigation button I get this error 'empty (sub)expression' from regexp.

 

what I need to do is take the below code where I assign my variable and make it use the last value it held if a null value is returned? is that possible?

 

 

$name = $_POST['select'];  

// Gets its value from a drop down selct form //

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/89676-solved-_postselect-null-help/
Share on other sites

If you want to do that, you are going to have to store the values it held previously. You can do that in a database, a cookie, a hidden tag, or a GET/POST variable. If you save it in a session variable ($_SESSION['name']) then you could do something like this:

 

if($_POST['select'] == "")
{
     $name = $_SESSION['name'];
}
else
{
     $name = $_POST['select'];
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.