Forums

Simple searching function. How?

guillegm 13 Mar, 2012
Hi,
I have a form that saves data correctly into a table. I made another form to search these records. I've read these topics many times (http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&t=22966 and http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&t=43294) but not resolve my question.
When I search only get the results in the debugger code, not in my custom code. My form actions:
[attachment=0]actions_search_form.jpg[/attachment]
My custom code:
<table>
<?php
foreach($form->data['Cercar_Accident'] as $detail):
?>
<tr>
<td>Lloc: <?php echo $detail['lloc']; ?></td>
<td>Referencia: <?php echo $detail['Ref_Policial']; ?> </td>
</table>

The action of my form is "post" because when is "get" and submit url is the same url of this form, don't display nothing.
I think the "where code" is fine because in the debugger I get the correct result and the query is good. The link of my form is this http://policiamunicipal.olot.cat/extern/index.php?option=com_chronoforms&chronoform=Cercar_Accident and if you search "dead" should to get results.
Why don't get the results in the "Custom code - Show results html" action?
Thanks!!
GreyHead 13 Mar, 2012
Hi guillegm,

It looks as though the Custom Code is missing the closing endforeach;

Bob
guillegm 14 Mar, 2012
Thanks Grayhead!!!
I has 3 mistakes in my form:
-I needed to close the foreach
-The action mode of my custom code must be "Controller"
-The model id is case sensitive. In DB Multi Record loader had put "Cercar_accident" and in the custom code "Cercar_Accident".

Thanks you! 😀 😀 😀 😀
This topic is locked and no more replies can be posted.