• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

insert values in field database by check boxes

New Here ,
Jun 15, 2007 Jun 15, 2007

Copy link to clipboard

Copied




I had a similar error and probem when using dropdown instead of a check box. It was resolved by putting SELECT name="CarMake in the drop down.

But in the checkbox, I don’t know?
I seems like the problem is the action page has the Form.carmake but the entry page does not. What am I missing and where do I put in the entry page below.


The key goal is to have checkboxes checked to insert values into the database field carmake based on what is checked.


If the checkbox Honda is checked then
it inserts to the carmake field the value Honda.

If the checkbox Toyota is checked then
it inserts to the carmake field the value Toyota.

If both are checked then 2 records are inserted both values
Honda and Toyota.

Same for the last option.

Thanks for all your help


Here is the error again

error:
Error Occurred While Processing Request
Element CARMAKE is undefined in FORM.

12:21:50.050 - Expression Exception - in C:\CFusionMX7\wwwroot\Author\CarAddAction.cfm : line 16
Element CARMAKE is undefined in FORM.

line 16 is:
'#Trim(Form.carmake)#',
Attach Code


<!------------here is the form------------>
<html>
<head>
</head>

<body>


<h1> </h1>

<table>
<cfform action="CarAddAction.cfm" method="POST">
<tr>
<td>Honda:</td>
<td><center><input type="checkbox" name="HONDA_MODEL" value="HONDA" checked></center></td>
</tr>
<tr>
<td>Toyota:</td>
<td><center><input type="checkbox" name="Toyota_MODEL" value="Toyota" Unchecked></center></td>
</tr>
<tr>
<td>SUBARU:</td>
<td><center><input type="checkbox" name="SUBARU_MODEL" value="SUBARU" unchecked></center></td>
</tr>



<tr><td>Honda Model</td>
<td>
<input type="Text"
name="Honda_Model"
Value=""
size="22"
maxlength="20">
</td>
<tr></tr>
<tr><td>Toyota Model</td>
<td>
<input type="Text"
name="Toyota_Model"
Value=""
size="22">
</td>
<tr></tr>
<tr><td>Subaru Model</td>
<td>
<input type="Text"
name="Subaru_Model"
Value=""
size="22">
</td>
<tr></tr>
<td> </td>
<td>
<input type="submit" value="Add make to Database">
</td>
</tr>

</cfform>
</table>

</body>
</html>



<!--------Action page
--------->
<cfdump var = "#form#">
<cfquery name="InsertCarInfo"
datasource="#Request.MainDSN#">
INSERT INTO Car_tab(
car_Make,
Honda_Model,
Toyota_Model,
Subaru_Model

)
VALUES (

'#Trim(Form.carmake)#',
'#Trim(Form.Honda_Model)#',
'#Trim(Form.Toyota_Model)#',
'#Trim(Form.Subaru_Model)#'
)
</cfquery>

TOPICS
Advanced techniques

Views

316

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2007 Jun 16, 2007

Copy link to clipboard

Copied

LATEST
Your error is reporting carmake not found, I also don't see it in your form. In the first Trim line, you have Form.carmake, but there is no field in your <cfform> that defines a field with the name carmake.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation