線上書籍

Home

[1002] PHP入門班

<?php //引入共同檔 require_once "header.php"; //變數初始化 $op=isset($_REQUEST['op'])?$_REQUEST['op']:""; //$class_sn=isset($_REQUEST['class_sn'])?intval($_REQUEST['class_sn']):""; //流程控制 switch($op){ case "insert_article": insert_article(); break; default: $main=article_form(); break; } //套用樣板 theme("theme.html"); /*************** 功能函數區 **************/ //輸入學習收藏的表單 function article_form(){ $main="<h3>輸入學習收藏</h3> <form action='{$_SERVER['PHP_SELF']}' method='post'> <table> <tr> <th>您的姓名:</th> <td><input type='text' name='stud_name' size='10'></td> <th>班級:</th> <td> <select name='class_sn'> <option value=''>請選擇班級</option> </select> </td> </tr> <tr> <th>學習收藏內容</th> <td colspan=3><textarea name='content' cols=50 rows=8></textarea></td> </tr> <tr> <th>設定密碼:</th> <td><input type='text' name='text_passwd' size='10'></td> <th>是否發布?</th> <td> <input type='radio' name='enable' value='1' id='enable'><label for='enable'>發布</label> <input type='radio' name='enable' value='0' id='unable'><label for='unable'>暫不發布</label> <input type='hidden' name='op' value='insert_article'> <input type='submit' value='儲存'> </td> </tr> </table> </form> "; return $main; } //執行儲存動作 function insert_article(){ } ?>