[SOLVED] Saving data from the frontend
Posted: Tue Jan 01, 2008 7:46 pm
I'm coding a component to display a simple list of events and I've hit a roadblock. I need to make it possible to add events from the frontend but when trying to save an event it throws me an 403-forbidden when the form action is set to "index.php?option=com_callisto".
If I set the action to "index.php" I get redirected back to the the component but nothing is saved in the database. Could someone give me some pointers here?
My save-function looks like this:
My database class looks like this:
Code: Select all
Forbidden
You don't have permission to access /index.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
My save-function looks like this:
Code: Select all
function save () {
$option = JRequest::getCmd('option');
$this->setRedirect('index.php?option=' . $option);
$post = JRequest::get('post');
$row =& JTable::getInstance('Callist', 'Table');
if (!$row->bind($post)) {
return JError::raiseWarning(500, $row->getError());
}
if (!$row->store()) {
return JError::raiseWarning(500, $row->getError());
}
$this->setMessage('Händelse inlagd');
}
Code: Select all
defined('_JEXEC') or die ('Restricted access');
class TableCallist extends JTable {
var $event = null;
var $eventlink = null;
var $arrangedby = null;
var $contactname = null;
var $contactphone = null;
var $contactemail = null;
var $startdate = null;
var $enddate = null;
var $lastdate = null;
var $location = null;
var $description = null;
var $city = null;
var $streetaddress = null;
var $postcode = null;
var $id = null;
function __construct(&$db)
{
parent::__construct( '#__callisto', 'id', $db );
}
}