这个哪里有错了 高手看一下 谢了
时间:2011-09-02
来源:互联网
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>books_update</title> </head> <body> <h2>update books</h2> <br/><br/> <?php //connect mysql include_once "../conn.php"; $id=$_GET['update']; $result=mysql_query("select * from books where id='$id'"); $arr=mysql_fetch_array($result); if ($arr){ ?> <form action="" method="post"> <table width="800" border="1" cellspacing="0" cellpadding="0" align="center" > <tr> <td width="48" align="center" >id</td> <td width="161" align="center">one_head</td> <td width="374" align="center"><input type="text" name="one_head" value="<?php echo $arr['one_head'];?>" size="30"/></td><td width="207"><?php if ($_POST['one_head']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td rowspan="9" width="48"><?php echo $arr['id'] ?></td> <td width="161" align="center">one_body</td> <td width="374" align="center"><input type="text" name="one_body" value="<?php echo $arr['one_body'];?>" size="30"/></td><td><?php if ($_POST['one_body']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">two_head</td> <td width="374" align="center"><input type="text" name="two_head" value="<?php echo $arr['two_head'];?>" size="30"/></td><td><?php if ($_POST['two_head']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">two_body</td> <td width="374" align="center"><input type="text" name="two_body" value="<?php echo $arr['two_body'];?>" size="30"/></td><td><?php if ($_POST['two_body']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">three_head</td> <td width="374" align="center"><input type="text" name="three_head" value="<?php echo $arr['three_head'];?>" size="30"/></td><td><?php if ($_POST['three_head']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">three_body</td> <td width="374" align="center"><input type="text" name="three_body" value="<?php echo $arr['three_body'];?>" size="30"/></td><td><?php if ($_POST['three_body']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">four_head</td> <td width="374" align="center"><input type="text" name="four_head" value="<?php echo $arr['four_head'];?>" size="30"/></td><td><?php if ($_POST['four_head']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">four_body</td> <td width="374" align="center"><input type="text" name="four_body" value="<?php echo $arr['four_body'];?>" size="30"/></td><td><?php if ($_POST['four_body']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">video_head</td> <td width="374" align="center"><input type="text" name="video_head" value="<?php echo $arr['video_head'];?>" size="30"/></td><td><?php if ($_POST['video_head']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td width="161" align="center">video_body</td> <td width="374" align="center"><input type="text" name="video_body" value="<?php echo $arr['video_body'];?>" size="30"/></td><td><?php if ($_POST['video_body']==""){ echo "<font color='#ff0000'> * not null</font>";}else{ echo "<font color='#0000ff'> true</font>";}?></td> </tr> <tr> <td align="center" colspan="3"><input type="submit" name="update" value="update" /> <input type="reset" name="reset" value="reset" /></td> </tr> </table> </form> <?php if($_POST['update']){ if (!$_POST['one_head'] && !$_POST['two_head'] && !$_POST['three_head'] && !$_POST['four_head'] && !$_POST['video_head']){ echo "<br/>"; echo "head is not null"; }elseif(!$_POST['one_body'] && !$_POST['two_body'] && !$_POST['three_body'] && !$_POST['four_body'] && !$_POST['video_body']){ echo "<br/>"; echo "body is not null"; }else{ $result_one=mysql_query("update books set `one_head`='$_POST[one_head]',`two_head`='$_POST[two_head]',`three_head`='$_POST[three_head]',`four_head`='$_POST[four_head]',`video_head`='$_POST[video_head]',`one_body`='$_POST[one_body]',`two_body`='$_POST[two_body]',`three_body`='$_POST[three_body]',`four_body`='$_POST[four_body]',`video_body`='$_POST[video_body]' where id='$id'")or die("not successful"); echo "<br/>"; echo "<p><font color='#0000FF'>update is successful,please select the table</font></p>"; } } } ?> </body> </html>
作者: yhwl2258 发布时间: 2011-09-02
作者: xuzuning 发布时间: 2011-09-02
作者: yhwl2258 发布时间: 2011-09-02
作者: xuzuning 发布时间: 2011-09-02
作者: wswssx 发布时间: 2011-09-02
所以还是看一下 这个语法有没有问题
这个代码 如下
PHP code
<?php if($_POST['update']){ if (!$_POST['one_head'] && !$_POST['two_head'] && !$_POST['three_head'] && !$_POST['four_head'] && !$_POST['video_head']){ echo "<br/>"; echo "head is not null"; }elseif(!$_POST['one_body'] && !$_POST['two_body'] && !$_POST['three_body'] && !$_POST['four_body'] && !$_POST['video_body']){ echo "<br/>"; echo "body is not null"; }else{ $result_one=mysql_query("update books set `one_head`='$_POST[one_head]',`two_head`='$_POST[two_head]',`three_head`='$_POST[three_head]',`four_head`='$_POST[four_head]',`video_head`='$_POST[video_head]',`one_body`='$_POST[one_body]',`two_body`='$_POST[two_body]',`three_body`='$_POST[three_body]',`four_body`='$_POST[four_body]',`video_body`='$_POST[video_body]' where id='$id'")or die("not successful"); echo "<br/>"; echo "<p><font color='#0000FF'>update is successful,please select the table</font></p>"; } } } ?>
作者: yhwl2258 发布时间: 2011-09-02
作者: jordan102 发布时间: 2011-09-02
作者: yhwl2258 发布时间: 2011-09-02
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28