NASEEMA
asked on
check box question
hi experts,
<input type="checkbox" default="" name="chk">
<cfquery datasource="test" name="disp">
select * from employee
</cfquery>
<input type="submit" value="ok" name="submit">
when i check the check box and click on ok button i want to store the name and number into details table.
how to do this.
i tried like this
<cfif chk eq 1>
<cfquery datasource="insert" name="ins">
insert into details where username =#un# and number=#no#
</cfquery>
</cfif>
<input type="checkbox" default="" name="chk">
<cfquery datasource="test" name="disp">
select * from employee
</cfquery>
<input type="submit" value="ok" name="submit">
when i check the check box and click on ok button i want to store the name and number into details table.
how to do this.
i tried like this
<cfif chk eq 1>
<cfquery datasource="insert" name="ins">
insert into details where username =#un# and number=#no#
</cfquery>
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So, if you have a form that looks like:
--------------------------
<form action="actionPage.cfm" method="post">
<input type="checkbox" name="chk" value="1"> Check Here To Store Name and Number
<br><br>
Name: <input type="text" name="name"><br>
Number: <input type="text" name="number"><br>
<input type="submit" value="ok" name="submit">
</form>
--------------------------
On your action page you could do something like:
<cfif isDefined("form.chk") and form.chk is 1>
DO YOUR INSERT
</cfif>
Or,
<cfif structKeyExists(form,"chk"
DO YOUR INSERT
</cfif>
Or,
<cfparam name="form.chk" default="0">
<cfif form.chk is 1>
DO YOUR INSERT
</cfif>