Newbie Here: Basic Front-End Component Help
Posted: Thu Feb 14, 2008 2:00 pm
Hi All,
I am very new to the Joomla system and need a little help with a component I'm creating. What im trying to do is have a search form that the user fills out (zip code / suburb) and I need to pass these variables to a function to use in my query, I'm just a little stuck, could someone please help as to what i need to do. Please see below, thanks in advance
clublocator.php
clublocator.html.php
I am very new to the Joomla system and need a little help with a component I'm creating. What im trying to do is have a search form that the user fills out (zip code / suburb) and I need to pass these variables to a function to use in my query, I'm just a little stuck, could someone please help as to what i need to do. Please see below, thanks in advance

clublocator.php
Code: Select all
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.helper');
require_once( JApplicationHelper::getPath( 'html' ) );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.$option.DS.'tables');
switch($task) {
case 'search':
clubSearch($option);
break;
default:
searchForm($option);
break;
}
function searchForm($option) {
HTML_clublocator::searchForm($option);
}
function clubSearch($option) {
$row =& JTable::getInstance('clublocator', 'Table');
$code = JRequest::getVar( 'postcode', '6000', 'POST' );
HTML_clublocator::clubSearch($option, $code);
}
?>
Code: Select all
<?php
class HTML_clublocator
{
function searchForm($option) {
?>
<table>
<FORM METHOD=POST ACTION="index.php">
Zip Code <INPUT TYPE="text" NAME="postcode"><BR>
Suburb <INPUT TYPE="text" NAME="suburb"><BR>
<INPUT TYPE="submit">
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="search" />
</table>
<?php
}
function clubSearch($option) {
}
}
?>