PHP page
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/><?php//Initialization act$_request[' Act ']=$_request[' act ']?$_request[' act ']: '; if ($_request[' act ']== ' Add ') {include ' templates/zhiliang_add.php ';} ElseIf ($_request[' act ']== ' Insert ') { //File Upload //var_dump ($new _file_name); $title =$_post[' title '; $content =$_post[' content '; $time =$_post[' time '; Include ' db.class.php '; $DB =new db (' localhost ', ' root ', ' 123 ', ' Fanyi '); $sql = "INSERT into Zhiliang values (null, ' $title ', ' $content ', ' $time ')"; if (mysql_query ($sql)) { echo "add Success"; } }
--------------------------------------------------------------------------------------------------------
HTML page
<form method= "POST" action= "zhiliang.php" name= "theform" enctype= "Multipart/form-data" onsubmit= "Return Validate ( ) "><table cellspacing=" 1 "cellpadding=" 3 "width=" 100% "> <tr> <td class=" label "> title </td> & Lt;td><input type= "text" name= "title" Maxlength= "value=" "/><span class=" Require-field ">*</ span></td> </tr> <tr> <td class= "label" > Time </td> <td><input type= "text" n Ame= "Time" maxlength= "size=" "value=" "/></td> </tr> <tr> <td class=" label "> article content < ;/td> <td><textarea name= "content" cols= "rows=" 4 "></textarea></td> </tr> < ;tr> <td colspan= "2" align= "center" ><br/> <input type= "Submit" class= "button" value= "OK"/> ; <input type= "Reset" class= "button" value= "reset"/> </td> </tr></table></form>