homepage Welcome to WebmasterWorld Guest from 54.226.0.225
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Errors - Search php script
Scotty13




msg:4442999
 2:19 pm on Apr 19, 2012 (gmt 0)

I'm following some tutorials online and this is my tktedmembers_search script. Searching for new members, first name or airline.

I get this error when I test in my browser...

Notice: Undefined index: fname in /home/********/public_html/root/tktedmembers_search.php on line 19

Deprecated: Function eregi_replace() is deprecated in /home/********/public_html/root/tktedmembers_search.php on line 22


When I test in for NAME in my search box, I get these errors...

Deprecated: Function eregi_replace() is deprecated in /home/********/public_html/root/tktedmembers_search.php on line 22


When I test in for AIRLINE in my search box, I get these errors...

Notice: Undefined index: fname in /home/myglobal/public_html/root/tktedmembers_search.php on line 19

Deprecated: Function eregi_replace() is deprecated in /home/*******/public_html/root/tktedmembers_search.php on line 22



Script below with lines numbered. Thanks so much & sorry so many errors, S

<snipped code>

[edited by: eelixduppy at 2:35 pm (utc) on Apr 19, 2012]
[edit reason] removed code dump [/edit]

 

rocknbil




msg:4443054
 4:29 pm on Apr 19, 2012 (gmt 0)

Notice: Undefined index: fname in /home/********/public_html/root/tktedmembers_search.php on line 19


Haven't we had this conversation? :-) You have an array or an incoming post or get value that has either not been defined or is not submitting.

$foo = array();
echo $foo['mykey']; // WARNING

$foo = array(
'mykey' => null,
'yourkey => null
);
echo $foo['mykey']; // Doesn't echo anything because it's null, but no error or warning.

<form method="post" action="myscript.php">
<p><input type="text" name="first_name"></p>
<p><input type="submit" value="Go"></p>
</form>

echo $_POST['fname']; // WARNING - there is no "fname" in this form
if (isset($_POST['fname'])) {
echo $_POST['fname']; // Doesn't do anything - see above
}
else { echo "<p>No fname key found in post.</p>"; } // Now THERE's something useful that helps you

Deprecated: Function eregi_replace() is deprecated in /home/********/public_html/root/tktedmembers_search.php on line 22


This warning tells you that you're using an old script with a newer version of PHP on your server. You can **probably** ignore it but shouldn't, all instances of eregi_replace need to be swapped out with the preg_replace equivalent. It's not that difficult.

In case you don't understand the meaning of deprecated in reference to programming, it's an outdated or possibly insecure method that has been replaced by something better and your scripts need to be updated to use the newer implementation.

Scotty13




msg:4443095
 5:45 pm on Apr 19, 2012 (gmt 0)

Thank you, got it fixed.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved