Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing the select name to an update form

Status
Not open for further replies.

Turnipo

Programmer
May 21, 2001
3
AU
Folks,

I have created a small form that has a select list. I want the value of this select list passed to an update form when the user selects submit. I also have a hidden text field which gets passed also.

My hidden text field is passed fine. But i'm not get and value in the select when it is passed. The code is show below.

Any tips folks?



<FORM ACTION=&quot;editStudentRecordupdatecourse.cfm&quot; METHOD=&quot;Post&quot;>
<CFOUTPUT>
<INPUT TYPE=&quot;hidden&quot; name=&quot;studentID&quot; value='#form.studentID#'>
</CFOUTPUT>

Course<br>
<SELECT name=&quot;courseID&quot;>
<OPTION value=&quot;&quot;>
<CFOUTPUT query=&quot;getcourses&quot;>
<OPTION value=&quot;#getstudentdetails.courseid#&quot;> #getcourses.enrolcse# - #getcourses.title#
</CFOUTPUT>
</SELECT>

<p><INPUT TYPE=&quot;submit&quot; NAME=&quot;Submitform&quot; Value=&quot;Update Course&quot;>
</FORM>
 
Hi Turnipo,

Your code looks fine dough. What you can do to test if the value of the select box is not empty is to take a look at the source in your webbrowser.

If it's not blank make sure you made a selection. If nothing is selected it will return an empty field.

The CF code itself looks fine.


With kind regards
Bram
 
I tried selecting a item from the list.
This is the code on the update page.

<CFQUERY NAME=&quot;addStudent&quot; datasource=&quot;offshoreenrol&quot;>
UPDATE feepaid
SET courseID = #form.courseID#
WHERE studentno = '#form.studentid#'
</CFQUERY>

this is the error message i get in the browser
SQL = &quot;UPDATE feepaid SET courseID = WHERE studentno = '012345'&quot;

 
Hi Turnipo,

Okay, I think I can see the problem now. If your database fieldname is studentno is a numeric field you should use the code:

WHERE studentno = #form.studentid# --> do not use the ''
Instead of :
WHERE studentno = '#form.studentid#'


Hope this helped
Greetz
Bram

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top