[thelist] php question - changing one form value based on selectchoice

Paul Bennett Paul.Bennett at wcc.govt.nz
Mon Oct 17 20:22:38 CDT 2005


If this is server-side can't you just do a switch based on the select item value?

Switch($_POST['selectItem']){
	
Case '8':
	$price = '$8.00';
	break; 
	

	// Etc etc
}

If it's client side:

You can use an event attribute (onchange / onselect - .jeff feel free to shoot me anytime...) 
To trigger some kind of functiuon like this:

setHiddenValue(selectedItem){
	if(selectedItem.value == '8'){
		document.getElementById('myHiddenFormShhhhh').value = '$8.00';
	}
}

??

Paul

-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Jeniffer C. Johnson
Sent: Tuesday, October 18, 2005 2:05 PM
To: thelist at lists.evolt.org
Subject: [thelist] php question - changing one form value based on selectchoice

I think this might possible, but can't think of how to do it (and can't find an accurate search phrase). What I want is to have a form with a select list, and based on which option is selected, to send a specific hidden value with the other values when the form is submitted. So if, for example, Large is selected from the Size list, then a hidden field giving price of $10 is sent, but if Small is selected, then the hidden field is sent assigning price of $8.00. 

Jeniffer C. Johnson




-- 

* * Please support the community that supports you.  * * http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 


More information about the thelist mailing list