Dear Folks, I've tried a lots of method to insert my data into joomla database but it's not working. Below is my code:-
I want to know what is my mistake and how to insert it successfully. Thanks for any kind of help....
<?php
/**
*
* @file $Id: default.php 0.0.2 2012-12-28 00:00:00 Joydeep Banerjee $
* @package School Mangement System
* @version 0.0.2
* @description Simple School Management System component for joomla 2.5
* @copyright Copyright © 2012 - All rights reserved.
* @license GNU General Public License v2.0
* @author Joydeep Banerjee
* @author mail joy@vividtechno.com
* @website http://www.indiawebsitedesigndevelopment.com
*
**/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$app =& JFactory::getDocument();
$page_title = $app->getTitle();
$db =& JFactory::getDBO();
$name = $_POST['name'];
$class = $_POST['class'];
$db =& JFactory::getDBO();
$query = "INSERT INTO `#__jd` (`id`,name`, `class`)
VALUES ('',$name, $class);";
$db->setQuery( $query );
$db->query();
// YOUR CUSTOM CODE HERE
?>
<form action="index.php" method="post" name="adminForm">
<input type="hidden" name="option" value="com_sms" />
<input type="hidden" name="view" value="Sms" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
Name: <input type="text" name="name">
Class: <input type="text" name="class">
<input type="submit" value="Register" name="register">
</form>
I want to know what is my mistake and how to insert it successfully. Thanks for any kind of help....