Re: [PHP] PHP Notice: Undefined index
On Fri, May 19, 2006 6:08 pm, John Taylor-Johnston wrote: Any idea why this bit of code if(yes == $_POST['submitter']) { mysql_select_db($db,$myconnection); $sql = INSERT INTO `$db`.`$table` (name,email,comments,entrydate) values ('$name','$email','$comments','$entrydate'); mysql_query($sql) or die(print mysql_error()); } is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Because $_POST['submitter'] is not set? Because your script assumes it IS set? Because sometimes your script is called to display the form, before $_POST['submitter'] has anything in it, and sometimes it's called after they hit submit and it has something in it? if (isset($_POST['submitter']) yes == $_POST['submitter']){ http://php.net/isset -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Notice: Undefined index
Now I get it. Must be the version change? Richard Lynch a écrit: On Fri, May 19, 2006 6:08 pm, John Taylor-Johnston wrote: Any idea why this bit of code if(yes == $_POST['submitter']) { is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Because $_POST['submitter'] is not set? Because your script assumes it IS set? Because sometimes your script is called to display the form, before $_POST['submitter'] has anything in it, and sometimes it's called after they hit submit and it has something in it? if (isset($_POST['submitter']) yes == $_POST['submitter']){ http://php.net/isset -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Notice: Undefined index
Hi, Thanks. I see it, I get it, it makes sense. But it seems like overkill. So what version did this become necessary in? http://php.net/isset New server, new version. Or I had errors turned off on the old server. Thanks! John elseif ( (isset($_POST[number])) and (isset($_POST[submitter])) and (!isset($_POST[finalize])) and ($number) and (!$submitter)# and (!$finalize) ){ ? div class=special1h3Step 99: ?php echo $submitter; ?, You did not enter your name./h3 We are sorry. Please a href=?php echo $PHP_SELF; ?Start Again/a/div ?php } Richard Lynch wrote: is provoking [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Because $_POST['submitter'] is not set? Because your script assumes it IS set? Because sometimes your script is called to display the form, before $_POST['submitter'] has anything in it, and sometimes it's called after they hit submit and it has something in it? if (isset($_POST['submitter']) yes == $_POST['submitter']){ http://php.net/isset -- John Taylor-Johnston - If it's not Open Source, it's Murphy's Law. ''' Cégep de Sherbrooke: ô¿ô http://www.cegepsherbrooke.qc.ca/languesmodernes/ - 819-569-2064
RE: [PHP] PHP Notice: Undefined index
Any idea why this bit of code if(yes == $_POST['submitter']) { mysql_select_db($db,$myconnection); $sql = INSERT INTO `$db`.`$table` (name,email,comments,entrydate) values ('$name','$email','$comments','$entrydate'); mysql_query($sql) or die(print mysql_error()); } is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Undefined index means that the index does not exist, ie: the submitter value is not being set when the form is posted. Check the form that is posting the data and make sure that there is a value for submitter. FWIW, usually when I get this error it's because I managed to spell something wrong.. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Notice: Undefined index
2006/5/19, John Taylor-Johnston [EMAIL PROTECTED] : Any idea why this bit of code if(yes == $_POST['submitter']) { mysql_select_db($db,$myconnection); $sql = INSERT INTO `$db`.`$table` (name,email,comments,entrydate) values ('$name','$email','$comments','$entrydate'); mysql_query($sql) or die(print mysql_error()); } is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try using: if(isset($_POST['submitter']) yes == $_POST['submitter'])
Re: [PHP] PHP Notice: Undefined index
John Taylor-Johnston wrote: Any idea why this bit of code if(yes == $_POST['submitter']) { mysql_select_db($db,$myconnection); $sql = INSERT INTO `$db`.`$table` (name,email,comments,entrydate) values ('$name','$email','$comments','$entrydate'); mysql_query($sql) or die(print mysql_error()); } is provoking this message in my Apache error log? [Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index: submitter in /home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on line 29 Yes. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php