Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple options.value (Javascript & PHP)

Status
Not open for further replies.

goldensunrise

Programmer
Nov 22, 2000
18
So, I have a major case of Mommy brain today and have this project I have to finish like 6 months ago. Hopefully someone will have pitty on me and give me a little help that will send me in the right direction. I thank you in advance. Now on to my question, I know it should be an easy fix, just need to kick my programmer brain back into gear!

The Question:
If rock_size.options.value = small and inscription_type.options.value = both then estimated_cost = $5.00. How would I write that in "real" code. I am having a little trouble getting the correct options.value

Link:
Fill out the form so you can see where my trouble is. I haven't added validation on the e-mail yet so, you can put in whatever at the moment.
Code:
This is by no means my entire code. This is only the piece that I have a question about

Code:
<tr>
	<td>
		<input type="hidden" value="Rock Size" /><b>Rock Size</b> <br />Rock is a natural product - color and texture will vary.
	</td>
	<td>
		<select name="rock_size" id="rock_size">
		<option value="X-Small">X-Small ( 2"x 2.5")</option>
		<option value="Small">Small  (3" x 5")</option>
		<option value="Small/Medium">Small/Med (5" x 6")</option>
		<option value="Medium">Medium  (7" x  9")</option>
		<option value="Medium/Large">Med/ Large (9" x 10")</option>
		<option value="Large">Large  (12" x  11")</option>
		<option value="X-Large">X- Large  (14" x 12")</option>
		</select>
	</td>
</tr>

<tr>
	<td>
		<input type="hidden" value="Inscription Type" /><b>Inscription Type</b>
	</td>
	<td>
	<div id='dtype'>
		<select name="inscription_type" id="inscription_type">
		<option value="Both" selected>Both</option>
		<option value="Text">Text</option>
		<option value="Image">Image</option>
		</select>
	</div>
	</td>
</tr>
<tr>
	<td>
		<b>Estimated Cost:</b>
	</td>
	<td align="left">
	</td>
</tr>
 
I mean, how can I compare the two different Option Values? I am using a combination of Javascript and PHP to get the entire job done. This is only a small part of the job and I'm stuck!
 
In PHP it would be something like:

Code:
if(($_POST['rock_size']=="small")&&($_POST['inscription_type']=="both")){
$estimated_cost = "$5.00";
}

Of course if its Javascript you want then the JS forum is here:forum216

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top