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 19:42:40 +0000 UTC
Newsgroups: macromedia.coldfusion.getting_started

Yes 
 my goal is to have a user select a item in the drop down 
 based on what is selected 
 honda
 or
 toyota
 or 
 subaru.

 when they select it it will be inputed in the db table.

 <!--------this is CarAddForm.cfm once it is submitt then it goes to the action 
page CarAddAction.cfm------------>
 <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>
        </td>
 </tr>
                

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

 </cfform>
 </table>

 </body>
 </html>
 <!------this is 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>




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