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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.