Hello guys,
I need some help.
I have two forms, one to collect data the other to display it. It's working great. Except for one thing. I want to have at the top of the table a drop down menu so people can choos e a district near their house, so they see records only from that area. This is the code i have. I manually assign $escolha to viseu, and it works. But what i really want i for the value to be equal to whatever choosed in select menu. I can't make this work.
You can see the form here
I have seen the post here but don't seams to work for me. I have somehing wrong.
I know this as nothing to do with chronoforms. The problem is that i'm no good writing php, but still, can you give me a hand?
I trying to work this for a week and no solution.<br><br>Post edited by: GreyHead, at: 2008/03/21 18:24
I need some help.
I have two forms, one to collect data the other to display it. It's working great. Except for one thing. I want to have at the top of the table a drop down menu so people can choos e a district near their house, so they see records only from that area. This is the code i have. I manually assign $escolha to viseu, and it works. But what i really want i for the value to be equal to whatever choosed in select menu. I can't make this work.
<?php
// initialise the database code
global $database;
$escolha = "viseu";
$sql = "SELECT * FROM #__chronoforms_2 WHERE distrito = '$escolha';";
$database->setQuery($sql);
$rows = $database->loadObjectList();
echo "<table width=\"500px\">
<tr><td valign=\"middle\"><h1>Distrito</h1></td>
<td valign=\"middle\">
<select name=\"lista\" size=\"1\" id=\"lista\">
<option value=\"vazio\" selected>choose one</option>
<option value=\"Lisboa\">Lisboa</option>
<option value=\"Viseu\">Viseu</option></select> <input type=\"submit\" name=\"submit\" value=\"Test!\"> </td></tr>";
foreach ( $rows as $record ) {
echo "<tr>
<td colspan=\"2\"><h2>".$record->cf_id." | ".$record->especie." | ".$record->raca."</h2></td></tr>
<tr>
<td valign=\"top\">Em ".$record->data.", ".$record->nomeanimal.", tinha:<br />
Idade: ".$record->idade." anos<br />
Peso: ".$record->peso." kg<br />
Altura: ".$record->altura." cm<br /></td>
<td valign=\"top\">Reside com: ".$record->user.", ".$record->distrito."<br />
Telefone: ".$record->telefone."<br />
Email: ".$record->email."<br /></td>
</tr>";
}
echo "</table>";
You can see the form here
I have seen the post here but don't seams to work for me. I have somehing wrong.
I know this as nothing to do with chronoforms. The problem is that i'm no good writing php, but still, can you give me a hand?
I trying to work this for a week and no solution.<br><br>Post edited by: GreyHead, at: 2008/03/21 18:24