在PHP开发实战宝典一书博客系统的问题
发表在PHP图书答疑
2013-03-20
是否精华
是
否
版块置顶:
是
否
老师,我想问一下在第28章博客系统中 在朋友圈这个模块里,当我在friend.php页面输入信息点击提交之后会进入check_friend.php页面,并且会一直卡在这里,不能按照代码里所说的返回friend.php页面。看代码感觉是没有问题的,希望您能帮我解决下。
check_friend.php:
<?php
session_start();
include "Conn/conn.php";
if($_POST["regsubmit"]<>""){
$name=$_POST[txt_name];
$sex=$_POST[txt_sex];
$bir=$_POST[txt_bir];
$city=$_POST[txt_province].$_POST[txt_city];
$address=$_POST[txt_address];
$postcode=$_POST[txt_postcode];
$email=$_POST[txt_email];
$tel=$_POST[txt_tel];
$handset=$_POST[txt_handset];
$QQ=$_POST[txt_QQ];
$username=$_SESSION[username];
$INS="Insert Into tb_friend (name,sex,bir,city,address,postcode,email,tel,handset,QQ,username) Values ('$name','$sex','$bir','$city','$address','$postcode','$email','$tel','$handset','$QQ','$username')";
$result=mysql_query($INS);
if($result){
echo "<script> alert('该信息添加成功!');</script>";
echo "<script> window.location.href='friend.php';</script>";
}
else{
echo "<script> alert('添加操作失败!');</script>";
echo "<script> window.location.href='friend.php';</script>";
}
}
?>
check_friend.php:
<?php
session_start();
include "Conn/conn.php";
if($_POST["regsubmit"]<>""){
$name=$_POST[txt_name];
$sex=$_POST[txt_sex];
$bir=$_POST[txt_bir];
$city=$_POST[txt_province].$_POST[txt_city];
$address=$_POST[txt_address];
$postcode=$_POST[txt_postcode];
$email=$_POST[txt_email];
$tel=$_POST[txt_tel];
$handset=$_POST[txt_handset];
$QQ=$_POST[txt_QQ];
$username=$_SESSION[username];
$INS="Insert Into tb_friend (name,sex,bir,city,address,postcode,email,tel,handset,QQ,username) Values ('$name','$sex','$bir','$city','$address','$postcode','$email','$tel','$handset','$QQ','$username')";
$result=mysql_query($INS);
if($result){
echo "<script> alert('该信息添加成功!');</script>";
echo "<script> window.location.href='friend.php';</script>";
}
else{
echo "<script> alert('添加操作失败!');</script>";
echo "<script> window.location.href='friend.php';</script>";
}
}
?>