Form Filled values from mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apking
    New Member
    • Feb 2007
    • 32

    Form Filled values from mysql

    hi Friends,


    how to filled values from mysql database using php in html form.actually when user wants to edit his account.when fields filled with old details from musql database

    for example :

    <input type="text" name="uname" id="uname">

    uname value in mysql database.how to get that name using PHP.


    thanks
  • vikas1111
    New Member
    • Feb 2008
    • 122

    #2
    I am not sure regarding what you exactly want.. But i suppose this may help you.. Take a look..http://bytes.com/forum/thread797231.html

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      Not sure if I understand either, but incase I do:

      You need to connect to the database, and extract the field from where you want it. Like this:
      [PHP]$raw_form_data = mysql_query("
      SELECT uname
      FROM your_table_name
      WHERE another_table_v alue = 'your_way_to_ch oose'
      ") or die(mysql_error ());
      $form_data = mysql_fetch_arr ay($raw_form_da ta);
      [/PHP]

      And then:

      [PHP]<input type="text" name="<?php echo ($form_data['uname']); ?>" id="uname">[/PHP]

      If this is all new to you, you should do some tutorials on MySQL and PHP. We can suggest some if you like?

      Comment

      • apking
        New Member
        • Feb 2007
        • 32

        #4
        yea please suggest tutorials to me.iam new to PHP Programming.Tha nks for reply theservant


        apking

        Comment

        • vikas1111
          New Member
          • Feb 2008
          • 122

          #5
          http://www.w3schools.com/php/default.asp & php.net for php.. and mysql basics..

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            Originally posted by apking
            yea please suggest tutorials to me.iam new to PHP Programming.Tha nks for reply theservant


            apking
            No problem. Another good one for basics is Tizag

            Comment

            Working...