<?php require_once "header.php"; $op=isset($_REQUEST['op'])?$_REQUEST['op']:""; $class_sn=isset($_REQUEST['class_sn'])?intval($_REQUEST['class_sn']):""; if($op=="update"){ //SQL更新語法 $sql="update tncomu_class set `seme`='{$_POST['seme']}', `subject`='{$_POST['subject']}', `class_name`='{$_POST['class_name']}', `teacher`='{$_POST['teacher']}', `passwd`='{$_POST['passwd']}', `access`='{$_POST['access']}' where class_sn='$class_sn'"; }else{ //SQL新增語法 $sql="insert into tncomu_class (`seme`, `subject`, `class_name`, `teacher`, `passwd`, `access`) values('{$_POST['seme']}' , '{$_POST['subject']}' , '{$_POST['class_name']}' , '{$_POST['teacher']}' , '{$_POST['passwd']}' , '{$_POST['access']}')"; } //執行SQL語法 mysql_query($sql) or die("無法執行:".mysql_error()); //執行完轉向 header("location: index.php"); ?>