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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GET THE CONTENT FROM A FORM FIELD

Status
Not open for further replies.

alexfusion

Programmer
Feb 5, 2001
94
AR
Hello everyone,
I would like to know how to get the value entered for a visitor in a form field,so I can perform a search on a database based on the value entered for the visitor.
Here is the code I put in the action page but I get a type mismatch error:
<cfquery name=&quot;search_customer&quot; datasource=&quot;datasourcename&quot; dbtype=&quot;ODBC&quot;>
SELECT customer_name FROM customer_table
WHERE customer_name=#form.customername#
As you can see,here customername is the name of the form field in the page where the form is located.I built the form using the post method.
Could you indicate to me what is wrong.I know that the error is in the SQL statement but I don't know what is it.
Any help very much apprecciated!


Alexfusion

mixale@hotmail.com
 
Hey,

Few things to try. Without knowing your database I can't tell you for sure which will work but try them.

First try this because customername sounds like a string.

WHERE customer_name = &quot;#form.customername#&quot;
OR
WHERE customer_name = '#form.customername#'
OR
WHERE customer_name EQ #form.customername#
EQ is generally for integer or real numbers.

Have fun ... IF none of those work then post the Form that sends and tell us what datatype the form field is.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top