Hello all,
Still doing my best to get my head around some problems and so if what I suggest below is nonsense, please let me know.
The current problem is that I have a radio button form which, thanks to the coding, acts like a checkbox form because of what's happening in the name field
<table width="100%">
<tr>
<td colspan="3"><h3>Which level do you think you're currently are?</h3></td>
</tr>
<tr>
<td width="30%"><input type="radio" name="level[beginner]" id="beginner" value="1"/>
Beginner</td>
<td width="30%"><input type="radio" name="level[intermediate]" id="intermediate"
value="1"/> Intermediate</td>
<td width="30%"><input type="radio" name="level[advanced]" id="advanced" value="1"/>
Advanced</td>
</tr>
</table>
I've tried removing the [] tags which makes the radio button work fine but then gives me lots of warnings:
Warning: Invalid argument supplied for foreach() on line 247
Warning: implode() [function.implode]: Invalid arguments on line 252
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER by teachers.ID DESC' at line 8
The lines this refers to is:
foreach ($_POST['level'] as $key5=>$value)
{
if($value==1) $criteria[] = "teacherages.TeacherAges='$studentage' AND teacherlevel.TeacherLevel='".mysql_escape_string($key5)."' AND teachers.TypeLanguageTeacher='".mysql_escape_string($key4)."' AND teachersubject.TeacherSubject='$subject' ".$iscourse." ".$istown." ".$isdistrict." ".$isinvoice." AND teachers.County='".mysql_escape_string($county)."'";
}
$criteria = implode(' OR ', $criteria);
In reference to ORDER by teachers.ID DESC, here is the code:
$query = "SELECT Distinct teachers.DatePosted,teachers.FirstName,teachers.ID,teachers.Name,teachers.Town,teachers.county,teachersubject.TeacherSubject,teachersubject.TeacherCourse
From teachers Join teacherprice on teachers.ID=teacherprice.TeacherID
join teacherlevel on teachers.ID=teacherlevel.TeacherID
Join teacheravailable on teachers.ID=teacheravailable.TeacherID
join teachersubject on teachers.ID=teachersubject.TeacherID
Join teacherages on teachers.ID=teacherages.TeacherID
WHERE $criteria
ORDER by teachers.ID DESC";
What would be the best solution here? Would it be to make the radio buttons in php or would there have to be changes in the back end programming?
Many thanks in advance for your help.