$sql="INSERT INTO wyx_class (wyx_classname) VALUES ('$classname')";
$classname = $_POST['classname'].

解决方案 »

  1.   

    <form method="post" action="<?php echo $PATH_INFO?>">
    少了分号
    <form method="post" action="<?php echo $PATH_INFO;?>">
      

  2.   


    $classname = $_POST['classname']加上这句就可以了
      

  3.   

    if($submit)这里改成 if($_POST['submit'])试下
      

  4.   

    <?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{
    //显示表格
    ?>
      

  5.   


    <?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{ 
    //显示表格 
    ?> 
      

  6.   

    变量POST过去可以用$_POST['submit'],$_POST['classname']获得,不能直接用的
      

  7.   

    给你详细的改一下<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>
      

  8.   

    if($$_POST['submit']){
    多了个$LZ测试一下吧
      

  9.   

    啥也别说了,根本没POST,
    没接数据,怎么插入数据
      

  10.   

    <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>