Monday, September 05, 2005

Forms With Checkboxes

I have a form with checkboxes in it. I am trying to email the form using cfmail but I get this error:

Parameter 1 of function IsDefined, which is now "34.99", must be a syntactically valid variable name.

My checkbox in the form looks like this: <input type="checkbox" name="Urdu" value="34.99">

My cfmail page looks like this:
<cfmail from= "" to="" subject="Subject Here" server="" type="html">
<cfif IsDefined(FORM.Urdu)>#Form.Urdu#</cfif>

Is it because of the 34.99 with the decimal in it? I only want to pass the checked boxes in the form to the email message.

For the IsDefined function, you need to include the variable name inside double-quotes. You will want to pass in a specific string containing the variable name, not the contents of the variable.

Like this: <CFIF IsDefined("FORM.Urdu")>


Post a Comment

<< Home