Jump to content

Archived

This topic is now archived and is closed to further replies.

dooper3

Simple but confusing issue!

Recommended Posts

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:

[code]<?
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");
    }
}
?>[/code]

Any help much appreciated!!

Share this post


Link to post
Share on other sites
Change...
[code]
if (isset($_POST["find"])) {
[/code]
to...
[code]
if (isset($_POST["findphrase"])) {
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.