echo $("classname".$_GET["ID"]);
试一下???

解决方案 »

  1.   

    AddClass.php中:
    $id = $_GET['ID'];
    $name = "classname".$id;
    $classname = $_POST["$name"];
      

  2.   

    echo $_POST["classname".$_GET["ID"]];
      

  3.   

    AddClass.php
    <?php
    require("db_connect.php");
    if ($action=="add"){
    $sql="insert into classname(ClassName)values('".$ClassName."')";
    $query=mysql_query($sql,$conn);
    }
    if ($action=="update"){
    $ClassName=$_POST["classname".$_GET["ID"]];
    $sql="update classname set(ClassName='".$ClassName."') where ID=".$ID."";
    $query=mysql_query($sql,$conn);
    }
    if ($action=="del"){
    $sql="delete from ClassName where ID=".$ID."";
    $query=mysql_query($sql,$conn);
    }
    $sql="select * from ClassName order by Place";
    $query=mysql_query($sql,$conn);?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>PHP新闻管理系统</title>
    <link href="css/cssForMenu.css" rel="stylesheet" type="text/css">
    </head><body topmargin="0" leftmargin="0" bgcolor="#efefef">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td bgcolor="#D1E9E9"><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr> 
              <td width="587" height="22"><strong></strong></td>
            </tr>
          </table></td>
      </tr>
    </table><br>
    <form name="form1" method="POST" action="">
      <table width="350" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="cccccc">
        <tr align="center" bgcolor="#dfdfdf"> 
          <td height="20">类别名称</td>
          <td>级别</td>
          <td>修改</td>
          <td>删除</td>
        </tr>
    <?php 
    while ($line=mysql_fetch_array($query)){
    ?>
        <tr align="center"> 
          <td bgcolor="#efefef"><input name="ClassName<?php echo $line["ID"];?>" type="text" id="ClassName<?php echo $line["ID"];?>" value="<?php echo $line["ClassName"];?>"></td>
          <td bgcolor="#efefef"><select name="Place" id="Place">
              <option>10</option>
            </select> </td>
          <td bgcolor="#efefef"> <input type="submit" name="Submit" value="修改" onClick="form1.action='AddClass.php?ID=<?php echo $line["ID"]; ?>&action=update'"></td>
          <td bgcolor="#efefef"> <input type="submit" name="Submit2" value="删除" onClick="form1.action='AddClass.php?ID=<?php echo $line["ID"]; ?>&action=del'"></td>
        </tr>
      <?php
       }
       mysql_free_result($query);
       mysql_close($conn);
     ?>
      </table>
    </form>
    <br>
    <form action="AddClass.php?action=add" method="post" name="form" id="form">
      <table width="350" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="cccccc">
        <tr align="center" bgcolor="dfdfdf"> 
          <td height="20" colspan="3">增加类别名称</td>
        </tr>
        <tr align="center"> 
          <td width="172" bgcolor="#efefef"><input name="ClassName" type="text" id="deptname2"></td>
          <td width="51" bgcolor="#efefef"> <input name="reset" type="reset" id="reset" value="重置"></td>
          <td width="105" bgcolor="#efefef"> <input type="submit" name="Submit3" value="增加类别名称">
          </td>
        </tr>
      </table>
    </form>
    </body>
    </html>网站的源代码是这样的,我怎么也得不到值.
    高手们指点一下我把
      

  4.   

    <form name="form1" action="" method="post">
    <input type="text" name="classname" >
    </form>
    <?php 
     $classname=$_post['ClassName'];
    ?>
    为什么我这样取值得不到数据呢?
      

  5.   

    $classname=$_POST['ClassName'];
     
     $_POST是要大写的