Quote:
|
Originally Posted by jfulton
What exactly are you trying to do? I don't understand the problem, so your solution doesn't make much sense to me. It seems like you would be better off using arrays rather than individual variables... Could you post some of your code?
Why are you storing the name of the checkbox? I think that's where I'm confused - it doesn't really make much sense...Why don't you store the "fruit type" in the value of the check box? Then in your form processing page you could just plug in the array from the form into a session variable rather than dealing with x variables...
|
I have a form with 4 courses. When registering a student I have to select courses. So I created 4 checkboxes and a table with student name and 4 columns representing the courses. I have assigned the "vaules" of the checkboxes to 'Y' if checked and 'N' if not. So lets say I register a student for course 1 and 2, then after I submit the form, the data will be inserted in the table in this format:
student_name course1 course2 course3 course4
godwin................Y............ Y...........N...........N
It means the student has been registered for course 1 and 2 only.
Then I wanted to get the name of the course of 'Y' (checked) to be available in other pages using sessions. The problem is that I don't want to use if else staments after inserting the data but use it on the form based on values checked. And the solution nova912 gave is what exactly I needed!
Thanks nova912 that worked!.
