#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Gabrovo,N\A,Bulgaria
    Posts
    2
    Rep Power
    0
    hello,
    i want to get info from one form (i have 3 or 4 or 5 no meaning).etc. if you have 3 form:
    user, pass, e-mail and you want to search some people from there e-mail but it may search and by pass and user(S).
    Thanks

    P.S.Sorry for my Bad english...



    ------------------
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    if you have 3 form:
    user, pass, e-mail and you want to search some people from there e-mail but it may search and by pass and user(S).
    >>


    F0ry,

    i am writing a small example search script for you.


    search.html

    <html>
    <head>
    <title>
    Search</title>
    </head>
    <body>

    <form action="search.php3" method="post">
    Enter a Value: <input type="text" name="search_for">
    Search On:
    <input type="radio" name="radio" value="email">Email
    <input type="radio" name="radio" value="user">User
    <input type="radio" name="radio" value="pass">Pass
    <input type="submit" name="submit" value="search">
    </form>

    </body>
    </html>


    here is your search php page

    search.php3
    ------
    <?

    if (isset($submit)){
    //when user clicks on search button..

    $con=mysql_connect("localhost","username","password");
    //Your database connectivity

    mysql_select_db("databasename",$con);
    //Select your database..

    $query="SELECT * FROM tablename";

    if($radio=="email"){
    $query.= " WHERE email='$search_for'";
    //search for email..
    }elseif($radio=="user"){
    $query.= " WHERE user='$search_for'";
    // search for user
    }elseif($radio=="pass"){
    $query.= " WHERE pass='$search_for'";
    //search for pass
    }

    $result=mysql_query($query,$con);
    //issue the sql query for the search..

    if(mysql_num_rows($result)>0){

    // we have some result .so print it..
    echo " Search Resultsn";
    while($row=mysql_fetch_rows($result)){

    echo "User Name".$row["user"]."n";
    echo "Email".$row["email"]."n";
    }
    }else{
    echo "No Resultn";
    exit;
    }
    }else{
    echo "Error! you can't do thatn";
    exit;
    }
    ?>


    ----
    Change the above script according to your requirments..

    Good Luck!!



    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. Frames hijacked after remote search
    By Telejoke in forum Antivirus Protection
    Replies: 2
    Last Post: September 26th, 2007, 09:32 AM
  2. Making search forms
    By baelnorn in forum Scripts
    Replies: 2
    Last Post: March 8th, 2004, 07:57 PM
  3. Is there any alternative to fulltext search?
    By irishairpics in forum MySQL Help
    Replies: 2
    Last Post: December 10th, 2003, 02:40 PM
  4. Site html search with php?
    By stojan in forum PHP Development
    Replies: 1
    Last Post: November 17th, 2003, 09:20 PM
  5. Replies: 37
    Last Post: October 2nd, 2003, 08:09 AM

IMN logo majestic logo threadwatch logo seochat tools logo