php.. drvivng me around the bend..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • student_steve

    #1

    php.. drvivng me around the bend..

    hey guys.. just need a push in the right direction here, basically i am
    using phpMyAdmin to store data and running php scripts to
    search/add/manage the information in the database. it is like a friends
    reunited style website, i have figured out code on how to search for
    members, but i am wondering where to put this code?!
    after the user enters info on the website, there is a search button but
    how do i connect the code for searching onto this button so that when
    it is pressed, the results are returned?
    is it something like 'on click'..... and then the code?
    please post replies as i am really stuck!!
    thanks very much for your time
    steven

  • jonathan.beckett

    #2
    Re: php.. drvivng me around the bend..


    I've seen a pre-built friends-reunited solution before, and I'm
    wondering if that's the one you're using.

    Anyway...

    Normally you put a form in the page that calls another page, and make
    it "post" it's data..

    Example - in your page with the search form...

    <form method="POST" action="search. php">
    <input type="text" name="search" size="20">
    <input type="submit" value="Go!">
    </form>

    then in search.php, the $_POST variables have the contents of the form,
    which you might access like this...

    $search = $_POST["search"];

    .... and then you might do something with the database...

    $sql = "SELECT * FROM users WHERE foo LIKE
    '%".mysql_escap e_string($searc h)."%'";


    Hope that makes some sense...

    Comment

    Working...