21,886
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>增加栏目</title>
<style type="text/css">
<!--
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
if($submit){
//处理表格输入
$db=mysql_connect("localhost","root","dirdir");
mysql_select_db("wyx",$db);
$sql="INSERT INTO wyx_class (wyx_classname) VALUES ('$classname')";
$result=mysql_query($sql);
echo "OK!\n";
}else{
//显示表格
?>
<form method="post" action="<?php echo $PATH_INFO?>">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#666666">
<tr>
<td align="center" bgcolor="#666666" class="STYLE1">增加栏目</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="classname" type="text" id="classname" /></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
<?php
}//end if,if结束
?>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>增加栏目</title>
<style type="text/css">
<!--
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
if(!empty($_POST['classname']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
//处理表格输入
$db=mysql_connect("localhost","root","dirdir");
mysql_select_db("wyx",$db);
$classname = $_POST['classname'];
$sql="INSERT INTO wyx_class (wyx_classname) VALUES ('$classname')";
$result=mysql_query($sql);
echo "OK!\n";
}else{
//显示表格
?>
<form method="post" action="<?php echo $PATH_INFO?>">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#666666">
<tr>
<td align="center" bgcolor="#666666" class="STYLE1">增加栏目</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="classname" type="text" id="classname" /></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
<?php
}//end if,if结束
?>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>增加栏目</title>
<style type="text/css">
<!--
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
if($$_POST['submit']){
//处理表格输入
$db=mysql_connect("localhost","root","dirdir");
mysql_select_db("wyx",$db);
$classname = $_POST['classname'];
$sql="INSERT INTO wyx_class (wyx_classname) VALUES ('$classname')";
$result=mysql_query($sql);
echo "OK!\n";
}else{
//显示表格
?>
<form method="post" action="<?php echo $PATH_INFO?>">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#666666">
<tr>
<td align="center" bgcolor="#666666" class="STYLE1">增加栏目</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="classname" type="text" id="classname" /></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
<?php
}//end if,if结束
?>
</body>
</html>
<?php
if($submit){
//处理表格输入
$db=mysql_connect("localhost","root","dirdir");
mysql_select_db("wyx",$db);
$sql="INSERT INTO wyx_class (wyx_classname) VALUES (''.$_POST['classname']
.'')";
$result=mysql_query($sql);
echo "OK!\n";
}else{
//显示表格
?>
$classname = $_POST['classname']
$sql="INSERT INTO wyx_class (wyx_classname) VALUES ('$classname')";