Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-25-2012, 06:00 PM #1
- 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" /> </form>
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.
01-27-2012, 01:13 PM #2
- Join Date
- Jul 2011
- Chennai, India
- Thanked 5 Times in 5 Posts
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.