张美英 发表于 2012-11-20 18:55

我写的php代码(管理员的操作)遇到了瓶颈,求教,下面那几个submit怎么写啊???

<?
session_start();
if (!isset($_SESSION['user'])) {
            $_SESSION['user']="";
        exit;
}
?>

<?
$name=$_POST['name'];
$db = mysql_connect("localhost","root","642531") ;
mysql_select_db("news",$db);
$query="select name,password from info where status='0'";
$result=mysql_query($query) or die("稍后再试");
?>

<?php
if($user==""){
?>
<a href="register.php" target="_blank"><font color=#0000ff>注册帐号</font></a>
&nbsp;
<a href="load_1.php" target="_blank"><font color=#0000ff>用户登录</font></a>
<?
}else{

?>
<a href="quit.php" target="_self"><font color=#0000ff>退出</font></a>
&nbsp;
<a href="zone.php" target="_self"><font color=#0000ff>个人中心</font></a>
<?
}
if($user==""){
echo "<center>";
echo "<h2><font color=red>对不起!您还未登录!</font></h2>";

}else{
?>
<table width="755" border=1 cellSpacing=0 cellPadding=1 align=center>
<tr align=centerbgcolor=55aadd>
        <th width="168"><FONT style="FONT-SIZE: 14px">用户名</th>
        <th width="175"><FONT style="FONT-SIZE: 14px">密码</th>
        <th width="175"><FONT style="FONT-SIZE: 14px">管理</th>
</tr>

<tr>

<?

        while($myresult=mysql_fetch_array($result)){
?>
<tr align=middle bgcolor=77ccff>
    <td width="168" align=center bgcolor=55aadd>
<?
                echo $myresult;
?>
        <td width="175" bgcolor=77ccff align=center>
<?
echo $myresult;
?>
   </td>
        <td width="175" bgcolor=77ccff align=center>

        <input type=submit name="submit1" value="删除" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">

                <input type=submit name="submit2" value="修改" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">

                <input type=submit name="submit3" value="封锁" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
                <input type=submit name="submit4" value="解封" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
   </td>

</tr>
<?       
        }
?>

</table>
<?
}
?>

linux_c_py_php 发表于 2012-11-26 22:45

啥叫瓶颈... 原理理解了写php不就是码农吗

maochanglu 发表于 2012-11-30 11:55

先学学smarty吧。这个太乱。看不下去。
页: [1]
查看完整版本: 我写的php代码(管理员的操作)遇到了瓶颈,求教,下面那几个submit怎么写啊???