12-1
index.php
03 | require_once "header.php" ; |
06 | $op =isset( $_REQUEST [ 'op' ])? $_REQUEST [ 'op' ]: "" ; |
12 | case "insert_article" : |
14 | header( "location:{$_SERVER['PHP_SELF']}" ); |
29 | function article_form(){ |
32 | $sql = "select class_sn,class_name from tncomu_class where access='1' and seme='{$now_seme}' " ; |
33 | $result =mysql_query( $sql ); |
35 | while (list( $class_sn , $class_name )=mysql_fetch_row( $result )){ |
36 | $opt .= "<option value='$class_sn'>$class_name</option>" ; |
40 | $main ="<h3 style= 'color:#0066CC' >輸入學習收藏</h3> |
41 | <form action= '{$_SERVER[' PHP_SELF ']}' method= 'post' > |
45 | <td><input type= 'text' name= 'stud_name' size= '10' ></td> |
46 | <th>{ $now_seme }班級:</th> |
48 | <select name= 'class_sn' > |
49 | <option value= '' >請選擇{ $now_seme }班級</option> |
56 | <td colspan=3><textarea name= 'content' cols=50 rows=8></textarea></td> |
60 | <td><input type= 'text' name= 'text_passwd' size= '10' ></td> |
63 | <input type= 'radio' name= 'enable' value= '1' id= 'enable' ><label for = 'enable' >發布</label> |
64 | <input type= 'radio' name= 'enable' value= '0' id= 'unable' ><label for = 'unable' >暫不發布</label> |
65 | <input type= 'hidden' name= 'op' value= 'insert_article' > |
66 | <input type= 'submit' value= '儲存' > |
77 | function insert_article(){ |
78 | $sql = "INSERT INTO `tncomu_article`(`stud_name`, `content`, `post_time`, `enable`, `class_sn`, `mode`, `text_passwd`) VALUES ('{$_POST['stud_name']}' , '{$_POST['content']}' , now(), '{$_POST['enable']}', '{$_POST['class_sn']}', '文字', '{$_POST['text_passwd']}')" ; |
79 | mysql_query( $sql ) or die (mysql_error(). $sql ); |
90 | } elseif ( $mon >=3 and $mon <=8){ |