macromedia.coldfusion.getting_started
[Top] [All Lists]

Re: insert values to db based on drop down selected

Subject: Re: insert values to db based on drop down selected
From: "silviasalsa"
Date: Thu, 7 Jun 2007 20:31:38 +0000 UTC
Newsgroups: macromedia.coldfusion.getting_started

i replaced it and it went to the CARAddForm.cfm page.

 how ever when i selected honda and click on submit.
 i got this error

 Error Occurred While Processing Request  
 Element CAR_MAKE is undefined in FORM. 
  
 Exceptions

 13:29:40.040 - Expression Exception - in 
C:\CFusionMX7\wwwroot\Author\DropDownCarMake\CarAddAction.cfm : line 10
            Element CAR_MAKE is undefined in FORM.

 i looked at line 10 in the action page and it is
        '#Trim(Form.car_make)#'

 here is all the code in the action page CarAddAction.cfm

 <cfdump var = "#form#"> 
 <cfquery name="InsertCarInfo"
        datasource="#Request.MainDSN#">
 INSERT INTO Car_tab(
        car_Make

 )
 VALUES (

        '#Trim(Form.car_make)#'
 )
 </cfquery>



 <html>
 <head>
        <title>Car add make</title>
        <link rel="stylesheet" href="styles.css">
 </head>

 <body>

 <h1>&nbsp;</h1>

 <table>
 <cfform action="CarAddAction.cfm" method="POST">

 <tr>
        <td>Car</td>
        <td><!-----------
                <SELECT name="carMake" size="1">
 <OPTION Value = "Toyo">Please Select</OPTION>
 <OPTION Value = "Hon" <cfif carMake is "Honda">selected</cfif>>Honda</OPTION>
 <OPTION Value = "Toyo" <cfif carMake is 
"Toyota">selected</cfif>>Toyota</OPTION>
 <OPTION Value = "Suba" <cfif carMake is 
"Subaru">selected</cfif>>Subaru</OPTION>
 </select>------------> 

 <SELECT name="CarMake" >
 <OPTION Value = "Hon" >Honda</OPTION>
 <OPTION Value = "Toyo" >Toyota</OPTION>
 <OPTION Value = "Suba" >Subaru</OPTION>
 <OPTION selected value=""></OPTION>
 </select>
        </td>
 </tr>
        

 <tr>
        <td>&nbsp;</td>
        <td>
                <input type="submit" value="Add make to Database">
        </td>
 </tr>

 </cfform>
 </table>

 </body>
 </html>


<Prev in Thread] Current Thread [Next in Thread>