setExtra("style='width: 400px; color: white; background-color: #000000;'"); $Text->setExtra("style='width: 400px;'"); $Text->setExtra("placeholder='請輸入標題'"); $form->addElement($Text); $DateSelect=new XoopsFormTextDateSelect('投稿截止日', 'ebook_post_date', 15, $ebook_post_date); $DateSelect->setExtra("style='width: 100px;'"); $form->addElement($DateSelect); $DateSelect1=new XoopsFormTextDateSelect('出刊日', 'ebook_publish_date', 15, $ebook_publish_date); $DateSelect1->setExtra("style='width: 100px;'"); $form->addElement($DateSelect1); $Tray=new XoopsFormElementTray('', ' ', ''); $Tray->addElement(new XoopsFormButton('', '', '送出', 'submit')); $Tray->addElement(new XoopsFormButton('', '', '清除', 'reset')); $form->addElement($Tray); $Hidden =new XoopsFormHidden('op', 'insert_ebook'); $form->addElement($Hidden); $ebook_form = $form->render(); $xoopsTpl->assign('ebook_form' , $ebook_form); } //寫入資料庫 function insert_ebook(){ global $xoopsDB; $tbl=$xoopsDB->prefix('tad_ebook'); $sql="insert into `{$tbl}` (`ebook_title` ,`ebook_post_date` , `ebook_publish_date`) values('{$_POST['ebook_title']}' , '{$_POST['ebook_post_date']}' ,'{$_POST['ebook_publish_date']}')"; $xoopsDB->query($sql) or die(mysql_error()); } /*-----------執行動作判斷區----------*/ $op=empty($_REQUEST['op'])?"":$_REQUEST['op']; switch($op){ case "insert_ebook": insert_ebook(); header("location:{$_SERVER['PHP_SELF']}"); break; default: ebook_form(); break; } /*-----------引入檔案區--------------*/ include_once 'footer.php'; ?> ```
進階搜尋
553人線上 (213人在瀏覽線上書籍)
會員: 0
訪客: 553