I've searched the archives and this question seems closest to my own. But, unfortunately I've not been able to derive a solution from it. I have a form that users complete to create a list of questions from a large quiz database. The questions are categorised by subjects and graded by difficulty (1,2,3,4). Users can create a list of questions by selecting subjects and difficulty. It works fine. However we don't have many grade 1 questions on some subjects so want to combine the 1s and 2s into a single 'easy' grade. The form's option list works fine as below, but I want the second option to search for values 1&2 not just 2. Here's the relevant form code (it doesn't include all the subject details, just the difficulty selection):
<form action="" method="post" id="quizbuilder">
<table width="400" border="0">
<tr>
<td>number of questions</td>
<td><input name="quizSize" type="number" value="20" size="2" maxlength="2" min="1" max="50" /></td>
<td> </td>
</tr>
<tr>
<td>difficulty</td>
<td><select name="grade">
<option value="%" selected="selected">any</option>
<option value="2">easy</option>
<option value="3">medium</option>
<option value="4">difficult</option>
</select>
<td> </td>
</tr>
<tr>
The query looks like this:
mysql_select_db($database_qbquery, $qbquery);
$query_userquiz = sprintf("SELECT * FROM questions WHERE (grade LIKE %s) AND (topic1 LIKE %s OR topic2 LIKE %s OR topic3 LIKE %s) ORDER BY RAND() LIMIT %s", GetSQLValueString($userGrade_userquiz, "text"),GetSQLValueString($userTopic_userquiz, "text"),GetSQLValueString($userTopic_userquiz, "text"),GetSQLValueString($userTopic_userquiz, "text"),GetSQLValueString($userQuizSize_userquiz, "int"));
$userquiz = mysql_query($query_userquiz, $qbquery) or die(mysql_error());
$row_userquiz = mysql_fetch_assoc($userquiz);
$totalRows_userquiz = mysql_num_rows($userquiz);
Of course, what I'd love to do would be just put:
<option value="1,2">easy</option>
But I know that's not going to work because it's read as a string and not the values. Any help would be very much appreciated, my head is now spinning, it seems like it should be simple, but it's not to me.