I give up! Need PHP Help

Discussion in 'PHP' started by Pixel T., Oct 6, 2010.

Thread Status:
Not open for further replies.
  1. #1
    Hey guys,

    I have literally spent the past 3-4 hours trying to figure it out. Its probably something really simple but I cannot get it to work.

    I have a simple form

    <form method="post" action="">
    <input type="text" name="searcher" /><select name="searchers">
    <option value="keyword">Keyword</option>
    <option value="author">Author</option>
    <option value="topic">Topics</option>
    </select> <input type="submit" name="submit" value="" />
    </form>
    
    HTML:
    which is connected to this code

    <?php
    
    if(isset($_POST['submit']))
    {
    $searcher = $_POST['searcher'];
    $searchers = $_POST['searchers'];
    
    mysql_query("INSERT INTO recentsearch (search, type) VALUES ('$searcher','$searchers')");
    
     echo "<script type='text/javascript'> window.location = 'search.php?q=$searcher&search=$searchers'; </script>";
    }
    ?>
    
    PHP:
    When I run it, its suppose to enter whatever is in the input to the database. Instead, it adds 2 duplicate rows. I have done it this way for years and never had a problem like this.

    Any help is appreciated.

    Thanks,
     
    Pixel T., Oct 6, 2010 IP
Thread Status:
Not open for further replies.