#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Colombo, Western, Sri Lanka
    Posts
    41
    Rep Power
    14
    How can I display a search result from a table (mysql) in a form-field text-box in a webpage?

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

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    you can do that very easily.

    Here is a very small example for you :

    <?
    $con=mysql_connect('lcalhost','username','password');
    //database connectivity
    mysql_select_db('dbaname',$con);
    //select database

    $result=mysql_query("select * from tablename WHERE fieldname='somesearch value'",$con);
    //issue the sql query..

    if(mysql_num_rows($result)>0){
    //search results
    echo "<form method=post>"
    while($row=mysql_fetch_array($result)){
    //loop throgh result and print the value to text box..
    echo "<input type=text name=somename value=".$row["tablefieldname"]."><BR>";
    }
    echo "</form>";

    }else{
    echo "no results";
    exit;
    }
    ?>

    Good Luck!!


    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Indonesia
    Posts
    87
    Rep Power
    14
    The most important thing is :

    <?
    bla bla bla
    $fd = "<input type=text value="$variable">";

    print $fd;

    ?>

    Don't forget the " before and after the variable

    See ya

    ------------------
    CyberOsc
    sphmjf_oscario@gurlmail.com

    ** It's the world of Oscario **

Similar Threads

  1. Add $ENV{REMOTE_USER} to end of textarea field on a form
    By k9barry in forum HTML Programming
    Replies: 8
    Last Post: February 4th, 2004, 01:36 PM
  2. Inserting from form to multiple tables
    By barth in forum MySQL Help
    Replies: 0
    Last Post: January 25th, 2004, 09:27 AM
  3. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 06:40 PM
  4. sending form field data
    By bellcom in forum PHP Development
    Replies: 1
    Last Post: January 19th, 2004, 03:39 PM
  5. html form problem using mult select and file field
    By Justin_M in forum HTML Programming
    Replies: 4
    Last Post: January 5th, 2004, 07:13 PM

IMN logo majestic logo threadwatch logo seochat tools logo