In the Preview section I have code in the Custom Element Box:
<table border="0" width="100%" id="table1">
<tr>
<td align="center"> </td>
<td width="119" align="center">
<label align="left">
Console: <input type="text" name="keyword" size="33" class="text">
Games: <input type="text" name="keyword2" size="33" class="text">
</label>
<input type=submit value="Search" style="color: #6A0204; font-family: verdana; font-weight: normal; font-size:10px; background-color: #FFFFFF; float:center;" name="search">
</td>
<td width="30"> </td>
</tr>
</table>
Then for events I have On Load section, show html and on Submit I have Custom Code which is:
<?php
$db =& JFactory::getDBO();
$keyword = JRequest::getString('keyword', '', 'post');
$keyword2 = JRequest::getString('keyword2', '', 'post');
if ( $keyword OR $keyword2 ) {
$sql="
SELECT *
FROM `#__chronoforms_data_SponsorRegistration`
WHERE `Supported_Consoles` LIKE '%$keyword%' OR 'Supported_Games' LIKE '%$keyword2%'
ORDER BY `cf_id` DESC";
$db->setQuery($sql);
/*echo '<div>$sql: '.print_r($sql, true).'</div>';*/
$results = $db->loadRowList();
/*echo '<div>$results: '.print_r($results, true).'</div>';*/
foreach ($results as $result );
{
echo "First Name: " .$result [6]."<br />";
echo "Last_Name: " .$result [7]."<br />";
echo "Supported Games: " .$result [15]."<br />";
echo "Supported Consoles: " .$result [8]."<br />";
echo "Organistation or Company: " .$result [9]."<br />";
echo "Email: " .$result [12]."<br />";
echo "Website: " .$result [13]."<br />";
}
}
?>
Basically I want to know how loop through to show multiple results. So far only 1 record is being returned to my website page even when there is more then one match.
Also how would I go about allowing a user to Select a check box as an input?
One more issue..the registration form that create the table (this table is then searched by the above form) has some issues. I have a problem with saving check box values into my database. On events I have Supported_Consoles[] in the Handle Array section. This corresponds to <input type="checkbox" name="Supported_Consoles[]" id="supported_consoles_1" title="" value="XBOX360 " class="" /> (note that the supported_console_id changes for every checkbox I have.)
For example, if I check PS3 and XBOX360 checkbox it shows the following in the database: PS3 Supported_Games[]XBOX360 . Why would it be showing the 'supported_Games[]' for? Any solution for this!
Thank you! (sorry about the long post🙂