lukekelly Posted June 23, 2009 Share Posted June 23, 2009 As im sure a few people use Jumi for Joomla so you can put your own custom code in to be wrapped in Joomla. Ive done lots of wonderful things with it but the latest code im trying to implement has me stumped. Basically the script below presents as a drop down box where you can select from a field, so only that field is then displayed... a kind of filter i guess: <?php error_reporting(E_ALL); if (!isset($_POST['Submit'])) { // form not submitted ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <?php $res=mysql_query("SELECT DISTINCT client FROM jos_ay_client_activity order by client") or die(mysql_error()); echo "<select name=dropdown>"; while($row=mysql_fetch_assoc($res)) { echo "<option value='$row[client]'>$row[client]</a></option>"; } echo "</select>"; ?> <input type="Submit" value="Submit" name="Submit"> </form> <?php } else { // form submitted // set server access variables $dropdown = empty($_POST['dropdown'])? die ("ERROR: Select from dropdown") : mysql_escape_string($_POST['dropdown']); //Query $query = "SELECT * FROM jos_ay_client_activity WHERE client='$dropdown'"; $result = mysql_query($query) or die (mysql_error()); $num=mysql_numrows($result); echo "<b><center>Database Output</center></b><br><br>"; ?> <table> <tr><td><b>Month</b></td> <td><b>Year</b></td> <td><b>Client</b></td> <td><b>Surveys</b></td> <td><b>Air Tests</b></td> <td><b>Projects</b></td> <td><b>Bulks</b></td> <td><b>Entered</b></td> </tr></table> <? $i=0; while ($i < $num) { $month=mysql_result($result,$i,"month"); $year=mysql_result($result,$i,"year"); $client=mysql_result($result,$i,"client"); $surveys=mysql_result($result,$i,"surveys"); $airtests=mysql_result($result,$i,"airtests"); $project=mysql_result($result,$i,"project"); $bulks=mysql_result($result,$i,"bulks"); $datetime=mysql_result($result,$i,"datetime"); echo "<table>"; // check width echo "<tr><td>$month</td>"; echo "<td>$year</td>"; echo "<td>$client</td>"; echo "<td>$surveys</td>"; echo "<td>$airtests</td>"; echo "<td>$project</td>"; echo "<td>$bulks</td>"; echo "<td>$datetime</td></tr>"; echo "</table>"; ?><? $i++; } } ?></div> The problem i have is that when form is submitted i just get presented with the index page... to be honest i wasn't expecting it to work because of the type of script. I have tested the script on a seperate page and it works well. How would i go about implementing it to work in jumi/joomla? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/163341-joomla-jumi-and-my-code/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.