Jump to content


Photo

Simple but confusing issue!


  • Please log in to reply
1 reply to this topic

#1 dooper3

dooper3
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts
  • LocationLondon, UK

Posted 09 May 2006 - 03:05 PM

I have a simple script to enable administrators to search a MySQL database for a person's surname. The script works fine in Firefox and displays the data as it should, but when you click "search" in IE6, it does not return anything except the search form again.

Below is the code for my search form:

<?
echo ("
    <link type=\"text/css\" rel=\"stylesheet\" href=\"style.css\">
    <form action=\"$php_self\" method=\"post\">
    <table class=\"formtable\" align=\"center\">
    <tr><th colspan=\"2\">Search for a Club Member</th></tr>
    <tr><td><input class=\"form\" name=\"findphrase\"></td><td><input class=\"form\" type=\"submit\" name=\"find\" value=\"search\"></td></tr>
    </table>
    </form>
    ");
if (isset($_POST["find"])) {
    $term = addslashes($_POST["findphrase"]);
    echo ("You searched for \"$term\"<p>");
    include("db_connect.php");
    $sql = mysql_query("SELECT * FROM memberdata WHERE surname LIKE '%$term%'")
        or die ("Could not query the database");
    $num = mysql_numrows($sql);
    if ($num > 0) {
        echo ("Found $num results<p>");
        while ($row = mysql_fetch_array($sql)) {
            extract($row);
            echo ("<a href=\"members.php?choosemember=$uniID\" title=\"$forname $surname\">$forname $surname</a><br>");
        }
        mysql_close();
    } else {
        echo("No results found for that term, please try again");
    }
}
?>

Any help much appreciated!!
Personal: charliehawker.com
Educational: fantasticode.com

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 09 May 2006 - 03:35 PM

Change...
if (isset($_POST["find"])) {
to...
if (isset($_POST["findphrase"])) {





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users