Jump to content

<input>, $_POST, and header()


watagal

Recommended Posts

Greetings--PHP Code:

15:		$postRememberUserName = $_POST['chkRememberUserName'];16:		$postRememberPassword = $_POST['chkRememberPassword'];

Output:

Notice: Undefined index: chkRememberPassword in D:\xampp\htdocs\_mysites\clark-kleinheinz.com\Html_php_code\processSignIn.php on line 16Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\_mysites\clark-kleinheinz.com\Html_php_code\processSignIn.php:16) in D:\xampp\htdocs\_mysites\clark-kleinheinz.com\Html_php_code\processSignIn.php on line 61

Both #15 & #16 are from <input type="checkbox"> elements in my Sign In form. The "'chkRememberUserName'" was checked and "'chkRememberPassword'" was unchecked. If Icheck both, I don't get these notices and warnings. Am I ok on this, no need to worry? Is a $_POST[] considered HTML code output, therefore the header() warning?TiA, Gal

Link to comment
Share on other sites

no, the warning is the html output, not the $_POST datau can better use isset($_POST['something']) to see if something is checked, to prevent warnings being givenexample:$postRememberUserName = isset($_POST['chkRememberUserName'])?true:false;$postRememberPassword = isset($_POST['chkRememberPassword'])?true:false;after this, both variables will be true if checked and false if not checked

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...