inbowns Posted May 12, 2011 Share Posted May 12, 2011 I have a select box and I would like to select data click on it and I guess it should reload the page and populate the text boxes i have below with the data from the database. Below is the code so you can have an idea what i'm trying to do. Is this possible and help would be greatly appreciate. Thanks in advance. <html> <head> <meta name="generator" content="PhpED Version 5.9.5 (Build 5989)"> <title> RSVP Administrator</title> <link rel="shortcut icon" href=""> </head> <body> <fieldset> <legend>Events</legend> <table> <tr> <td> Select an address: </td> <td> <SELECT NAME> <option value=' '> <? echo $option1 ?>;</option> </SELECT> </td> </tr> <tr> <td> Place of Event: </td> <td> <input type="text" name="location" value="<?php if($option1 == " "){ echo " ";} else{ echo $address_1;} ?>"> </td> </tr> <tr> <td> Address 1: </td> <td> <input type="text" name="address_1"> </td> </tr> <tr> <td> Address 2: </td> <td> <input type="text" name="address_2"> </td> </tr> <tr> <td> City: </td> <td> <input type="text" name="city"> </td> </tr> <tr> <td> State: </td> <td> <input type="text" name="state"> </td> </tr> <tr> <td> Zip Code: </td> <td> <input type="text" name="zip_code"> </td> </tr> <tr> <td> Telephone: </td> <td> <input type="text" name="phone"> </td> </tr> </table> </fieldset> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/ Share on other sites More sharing options...
dougjohnson Posted May 12, 2011 Share Posted May 12, 2011 Put this in your SELECT tag: <SELECT NAME="" onChange="this.form.submit()"> Then receive the values with $_POST at the top of the page. Or I may not understand your question? Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/#findComment-1214673 Share on other sites More sharing options...
dougjohnson Posted May 12, 2011 Share Posted May 12, 2011 Or you could use Ajax. Which is cooler but tricker to do. Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/#findComment-1214674 Share on other sites More sharing options...
inbowns Posted May 12, 2011 Author Share Posted May 12, 2011 Put this in your SELECT tag: <SELECT NAME="" onChange="this.form.submit()"> Then receive the values with $_POST at the top of the page. Or I may not understand your question? Something like what you wrote only I need the textboxes to fill in but on on submit when i select something from the select box i would like of the page to refresh and populate the textboxes. Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/#findComment-1214690 Share on other sites More sharing options...
dougjohnson Posted May 12, 2011 Share Posted May 12, 2011 ? If you use the [onChange=this.form.submit()] and add the $_POST's to receive the select values, the page will refresh and the text fields will be populated with the matching database values. This isn't what you want? Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/#findComment-1214693 Share on other sites More sharing options...
inbowns Posted May 13, 2011 Author Share Posted May 13, 2011 ? If you use the [onChange=this.form.submit()] and add the $_POST's to receive the select values, the page will refresh and the text fields will be populated with the matching database values. This isn't what you want? Sorry but this is not working I'm I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/236249-having-problems-with-selectbox-entry/#findComment-1215153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.