Jump to content

php form with js


mrooks1984

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.