hello there,
can somebody help me with my php/javascript code?
i want to load the corresponding data to a form everytime the user
selects an entry from a listbox.
the listbox contains the ID which i use to lookup in my database.
i already have the javascript function that calls an external php file to
query the database.
I can already retrieve the specific records from my db depending on the selected option.
my problem is on how to populate the form with the data that i got.
from my external php, i dont know how to access the fields of the html page or how to send back the values to the calling javascript function.
how would i go about this one?
help please. thank you.
passing values between php and javascript
Moderator: General Moderators
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: passing values between php and javascript
You have two options, depending on your form:tinks wrote:I can already retrieve the specific records from my db depending on the selected option.
After you retrieve the records, are you passing the records to Javaacript? If so, you can populate the HTML fields by JavaScript.
Other option is to put the fields that needs updating in a separate div. Generate HTML code for the whole div in PHP and then pass this to JavaScript. Then use innerHTML.value = .. to update the form.