mrooks1984 Posted August 3, 2012 Share Posted August 3, 2012 hello all, i have looked for a solution on Google but cant seem to find one, or maybe i have used the wrong keywords in the search. i am hoping someone can help me on here. i don't know much js at all, but i have a drop down menu built from php results from a database and i have a echo to display a separate field depending on what is selected. i need it to on a selection or a item in the drop down menu to update the php echo with a value depending on what was selected. i think the way is js, but not knowing js i am hoping someone can help me. Link to comment https://forums.phpfreaks.com/topic/266633-php-form-with-js/ Share on other sites More sharing options...
Mahngiel Posted August 3, 2012 Share Posted August 3, 2012 what do you have so far? Link to comment https://forums.phpfreaks.com/topic/266633-php-form-with-js/#findComment-1366588 Share on other sites More sharing options...
Jessica Posted August 3, 2012 Share Posted August 3, 2012 This is ajax. jQuery makes it easy. Link to comment https://forums.phpfreaks.com/topic/266633-php-form-with-js/#findComment-1366589 Share on other sites More sharing options...
mrooks1984 Posted August 3, 2012 Author Share Posted August 3, 2012 hello thanks for your responses. heres the code i have for a dropdown menu echo '<div id="StoreOption1">'; echo $option1_title; if ($option1_price > 0) { echo "£" . $option1_price . " "; } echo '<select name = "option1" >'; echo '<option value= "NULL">None</option>'; while ($row = mysql_fetch_assoc($res)) { if ($row['price'] > 0) { echo '<option value= "' . $row['value'] . '">' . $row['title'] . " + £" . $row['price'] . '</option>'; }else{ echo '<option value= "' . $row['value'] . '">' . $row['title']; } } echo '</select>' . '</div>'; } the value i want to update on selection from a dropdown menu echo "Price: ?" . $price . "<br />"; as you can see i dont have any js as of yet as i dont know where to start with that, hence why i come on here for help and advice. thanks all. Link to comment https://forums.phpfreaks.com/topic/266633-php-form-with-js/#findComment-1366608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.