Hi all. new member and fairly new to php/mysql. i wonder if someone can help. i am trying to create a simple form, with a single drop down list, populated from column 1 of a mysql table. what i need to happen is when an item is selected from the list, the text box underneath populates with the data from the same row in column 2 of the table, then the value of the textbox is posted to another table (but i already have that bit as i'm modifying an existing form) i just can't figure it it can happen either from the selection event or by using a button can anyone help? many thanks Karf
You'd have to either repload the page or use ajax. The event you are looking for is: <select name='whatever' onchange='captureEvent()'> To learn more about ajax, try this url: http://www.mousewhisperer.co.uk/ajax_page.html If, on the other hand you want to reload the page, you'd have to select the data from your table using a select statement. Ajax is very common today.
This is not hard at all. In your PHP script, use the result set from the database query to write a Javascript associative array which maps the values from column 1 to values in column 2. Write the dropdown values as usual. Then go to the Javscript forum and ask for help writing a function that fills in the text box from column 2 of the array.
ajax is for advanced user, karfeef is new on js field. a very good js resource to read is http://www.quirksmode.org/js/contents.html