Hello,
I'm tyring to do a very simple database seach form with just one field and a search button. The search form works in a separate php-file (on localhost), but not with the form I created using chronoforms. Is the placement of my php maybe wrong?
In "Form HTML" I have the following code:
And this php code I tried putting both in "Form HTML" and "On Submit code - before sending email:" but neither seems to work. All I get after hitting Search is a basic joomla page with no content. And I am of course supplying a searchword that exists in the database.
Thanks for your help!<br><br>Post edited by: zerynthia, at: 2008/03/11 22:15
I'm tyring to do a very simple database seach form with just one field and a search button. The search form works in a separate php-file (on localhost), but not with the form I created using chronoforms. Is the placement of my php maybe wrong?
In "Form HTML" I have the following code:
<input type="text" name="hakuehto" size="20" maxlength="20" value="" /> <input type="submit" value="HAE">
And this php code I tried putting both in "Form HTML" and "On Submit code - before sending email:" but neither seems to work. All I get after hitting Search is a basic joomla page with no content. And I am of course supplying a searchword that exists in the database.
<?php if (isset($_POST['hakuehto'])) { $yhteys = mysql_connect("localhost", "**", "**"«») or die(mysql_error()); mysql_select_db('yrityshaku', $yhteys) or die(mysql_error()); $_hakuehto = $_POST['hakuehto']; $result=mysql_query("SELECT * FROM perustiedot where toiminimi LIKE '%$_hakuehto%'"«»); if (!$result) { die('Invalid query: ' . mysql_error()); } $num=mysql_numrows($result); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $ytunnus=mysql_result($result,$i,"ytunnus"«»); $toiminimi=mysql_result($result,$i,"toiminimi"«»); $osoite=mysql_result($result,$i,"osoite"«»); $puhelin=mysql_result($result,$i,"puhelin"«»); $www=mysql_result($result,$i,"www"«»); $toimiala=mysql_result($result,$i,"toimiala"«»); echo "<b>$ytunnus $toiminimi</b><br>Osoite: $osoite<br>Puhelin: $puhelin<br>Www: $www<br>Toimiala: $toimiala<br><hr><br>"; $i++; } } ?>
Thanks for your help!<br><br>Post edited by: zerynthia, at: 2008/03/11 22:15