Jump to content

Undefined index: -- whats that mean?


JREAM

Recommended Posts

Notice: Undefined index: login in C:\Active_Projects\X8\cms\core\admin.settings.php on line 152

 

$login = $_POST['login'];

 

Above is what is on the line, am I not suppose to set variables to this?

What is a way to fix this?

 

something like: function p($value) { $_POST[$value]; }  ?

Link to comment
https://forums.phpfreaks.com/topic/124033-undefined-index-whats-that-mean/
Share on other sites

It means that there isn't an element in the $_POST array called login. I would assume you are expecting that there should be, so check the spelling of your form's name - don't forget it is case sensitive. Other than that, we'd need to see some more code to help you further.

$login = isset($_POST['login') ? $_POST['login'] : "";

This code is how I set variables sent via url.  First it checks if 'login' exists in the POST array, if it does it uses that value, if it doesn't it sets it to an empty string.  Of course you should also ALWAYS sanitize variables that are sent through a URL as they can be manipulated by the sender and used for an injection attack.

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.