Welcome to WebmasterWorld Guest from 54.144.48.252

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Errors - Search php script

     
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]

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

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
5:45 pm on Apr 19, 2012 (gmt 0)



Thank you, got it fixed.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month