Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2011
    Thanked 0 Times in 0 Posts

    auto fill fields from the database upon fetch

    I have a simple form right now:
    <form action='<? echo $PHP_SELF;?>' method='POST'>
    Username:<input type='text' name='username'><br>
    Email:<input type='text' name='email'><br>
    Posts:<input type='text' name='posts'><br>
    Joindate<input type='text' name='join'><br>
     <input type="submit" value="Submit" />
    What I need is, when the user fills his username and does one of the following:
    1.presses tab
    2.Presses enter
    3.clicks on a fetch button(fetch button does not exist now,i would like to know how to create it using javascript or anything else that suits my criteria)

    Once he does any of the above it should automatically generate the remaining fields from the database.
    The query would look like this:
    $qry=mysql_query("SELECT * from user where username =`$_POST['username']`");
    echo $row['posts] and so on..

    After it is autogenerated he can edit the fields and submit to update the database fields.

  2. #2
    New Coder
    Join Date
    Jul 2011
    Chennai, India
    Thanked 5 Times in 5 Posts
    Hi coding,

    You want to fill the rest of the controls from database when user enter his/her name in jquery. It's quite simple. All you need is:
    a) php file accepts the username and returns result in xml, json or other formats.
    b) receive the response and assign it to the appropriate controls.

    Please through the attached example file.
    XML format is used in the given example plus database dump also included in the attachement. Enter the title and then click the "Load" label in the index.html. Make sure the the title you entered is available in the table. I do not include any kind of validation in the example.

    Hope, it will help you.
    Still having question, let me know.
    Attached Files Attached Files


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts