954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Option tag two values

Hi guys

Is there a way, where i can get two values from a option tag. I have form that needs to have values for it to display e.g

My form looks like the following.

<form method="post" name="frmone" action="Result.cfm" enctype="multipart/form-data">

<select name="selvalues" id="selvalues" class="input_style-1" id="selvalues" style="height:19px">
		<option value="1">Select Result</option>            
		<cfoutput query="qtest" >  
                <option value="#value1#">#value2#</option>
                </cfoutput>
</select> 
<input name="Check" type="submit" value="Check" />
</form>


Results page

<cfif not isdefined("Form.frmone")> 
    <cfset Form.frmone= "N"> 
</cfif> 
<CFQUERY NAME="results" DATASOURCE="db">
Select * From tbl
Where col1="#value1#" and col2="#value2#";
</CFQUERY>


Am trying to get value2 to be added in the select as one of the conditions please help.Value 1 is going through need value 2.Please help:'(

tapuwa2002
Newbie Poster
22 posts since Dec 2008
Reputation Points: 10
Solved Threads: 1
 
Is there a way, where i can get two values from a option tag

No. If there isn't a unique key you can use instead, you could concatenate the values into a single string. Pick a delimiter that doesn't occur in the data. Then use list functions to separate the values.

<!--- form --->
<option value="#value1#:#value2#">#value2#</option>

<!--- action page --->
<cfset value1 = getToken(form.selvalues, 1, ":")>
<cfset value2 = getToken(form.selvalues, 2, ":")>
Where col1="#value1#" and col2="#value2#"


Don't forget to use cfqueryparam to protect against sql injection.

arrgh
Posting Whiz
381 posts since Dec 2008
Reputation Points: 32
Solved Threads: 47
 

Thanks

tapuwa2002
Newbie Poster
22 posts since Dec 2008
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You