Jump to content

Undefined Index?


Codeman0013

Recommended Posts

Hey guys i'm trying to update another site that was designed in 2004 and very outdated on the page for contact it has the following line:

 <?phpif ($_SESSION['inquirySuccess']) {echo "<tr><td valign=\"top\" colspan=\"2\" bgcolor=\"#FFFF99\"><p><strong>Thank you for your question.<br />  A Brintlinger and Earl representative will be in contact with you shortly.</strong></p></td><td> </td></tr><tr><td> </td><td> </td><tr>"; session_unset();session_destroy();}?> 

This line throws the error:Notice: Undefined index: inquirySuccess in /u/internet/com/brintlinger-earl/includes/content/submit_contact.php on line 6My question is why does it have this error, and how can i get rid of it?

Link to comment
Share on other sites

That's not an error per se, just a notice. The server apparently has PHP set to display messages for all warnings and notices, instead of just errors. One thing you can do is change php.ini so that it only displays messages for errors.The message means that inquirySuccess does not exist in the session, or, specifically, that "inquirySuccess" is not an index in the $_SESSION array. You can probably get rid of the notice by replacing the IF statement with this:if (isset($_SESSION['inquirySuccess'])) {or:if (array_key_exists("inquirySuccess", $_SESSION)) {

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...