如何获取文本框的值并插入到joomla的数据库中

时间:2014-05-30 06:15:17

标签: joomla

function create(){ 

$doc=JFactory::getDocument(); 
$post = JRequest::getVar('post');
$doc->addStyleSheet(JURI::root().'media/com_mycomp/css/frontend_create_task.css');
$doc->addScript(JURI::root().'media/com_mycomp/js/frontend_createtask.js');

echo "Welcome to Create"; 
$db=JFactory::getDbo(); 
$query=$db->getQuery(true); 
$query="INSERT INTO #__mycomp_posts (title,body) VALUES ('front Post','This is post body')";
$db->setQuery($query); 
$db->query();

    echo "<div id='welcome'>".JText::_('COM_MYCOMP_TASK_CREATE')."</div>";
}

0 个答案:

没有答案