I have a table which is currently displayed like this:
Question OptionType
What is 2+2
What is 3+3
What is 4+4
A-D
A-C
A-E
But I do not want it displayed like this obviously, the questions should go under the “Questions” heading and the option types should go under the “OptionType” heading. How can I get the table to be displayed as below:
Question OptionType
What is 2+2 A-D
What is 3+3 A-C
What is 4+4 A-E
Below is the code:
echo "<table>
<tr>
<th class='questionth'>Question</th>
<th class='optiontypeth'>Option Type</th>
</tr>";
foreach ($searchResults as $question) {
echo '<tr><td>'.htmlspecialchars($question).'</td></tr>';
}
foreach ($searchOption as $option) {
echo '<tr><td>'.htmlspecialchars($option).'</td></tr>';
}
echo "</table>";
When you build the arrays, merge them together so that it will look like
then you would do
However using the code you gave me, I would do it like this