| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1140 人关注过本帖
标题:PHP怎么处理多个页面表单传送过来数据问题 请教!!!
只看楼主 加入收藏
blqq
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-7
收藏
 问题点数:0 回复次数:0 
PHP怎么处理多个页面表单传送过来数据问题 请教!!!
四个文件分别为registry1  registry2  registry3  registry_do.php

  在前两个文件(registry1  registry2)的表单中输入的信息都在第三个文件(registry3)调用第四个文件(registry_do.php 执行处理文件)时才真正写入数据库。怎样才能确保在传送过程中把前三个文件的信息送到第四个文件(registry_do.php)?下边的代码需要怎么样修改才能把前三个文件的信息写入数据库?请前辈指点迷津,谢谢!

============================================================================================
第一个文件(registry1)代码
============================================================================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
    function check() //检查FORM内所填写的信息是否有误
    {
        if(document.regstep1.username.value == "")
        {
            alert("未输入帐号");
            return false;
        }
        if(document.regstep1.userpass.value == "")
        {
            alert("请勿使用空白密码");
            return false;
        }
        if(document.regstep1.userpass.value != document.regstep1.userpass2.value)
        {
            alert("两次输入的密码不同");
            return false;
        }
        if(document.regstep1.pass_ans.value == "")
        {
            alert("未输入密码提示答案");
            return false;
        }
        
        document.regstep1.submit();
        
    }
    
    function Checkname()
    {
        var Name = document.regstep1.username.value;
        //打开一个检查会员名称是否重复的新窗口
        window.open("uniquecheck.php?name="+Name,"check","width=300,height=10,status=0,scrollbars=0,resizable=1,menubar=0,toolbar=0,location=0");
    }
</script>
</head>

<body>
<form name="regstep1" method="post" action="registry2.php" onsubmit="return check()">
<br />
    <table width="446" border="1" bordercolor="#000000" align="center" cellspacing="0">
        <tr>
            <td>
                <table width="440" border="0" height="220" align="center" bgcolor="#eeeeee" cellspacing="0" cellpadding="0">
                    <tr>
                        <td colspan="2" bgcolor="#ffffff">
                             <div align="center"><img src="images/1.gif" width="298" height="41" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">帐     号</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="text" name="username" size="15" />                                                            <input onClick="javascript:Checkname()" type="button" value="检查帐号" name="button" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">密     码</div>
                        </td>
                        <td height="6" bgcolor="#ffffff">
                            <div align="center">
                                <input type="password" name="userpass" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">密 码 确 认</div>
                        </td>
                        <td height="2">
                            <div align="center">
                                <input type="password" name="userpass2" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">密 码 提 示</div>
                        </td>
                        <td height="2" bgcolor="#ffffff">
                             <div align="center">
                                 <select name="pass_rem">
                                     <option value="0">你家宠物的名字</option>
                                     <option value="1">你最想去的国家</option>
                                     <option value="2">你最喜欢的运动</option>
                                     <option value="3">你最讨厌的食物</option>
                                     <option value="4">你在家常做什么</option>
                                     <option value="5">你最爱看的电影</option>
                                 </select>
                             </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">答     案</div>
                        </td>
                        <td height="2">
                            <div align="center">
                                <input type="text" name="pass_ans" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" bgcolor="#ffffff">
                            <div align="center">
                                <input type="reset" name="submit" value="清除重填" />
                                <input type="submit" class="box1" name="submit2" value="下一步">
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</form>
</body>
</html>


============================================================================================

第二个文件(registry2)代码

============================================================================================



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

<form name="regstep2" method="post" action="registry3.php">
<input type="hidden" name="username" value="<?=$username?>" />
<input type="hidden" name="userpass" value="<?=$userpass?>" />
<input type="hidden" name="pass_rem" value="<?=$pass_rem?>" />
<input type="hidden" name="pass_ans" value="<?=$pass_ans?>" />
 <br>
     <table width="446" border="1" bordercolor="#000000" align="center" cellspacing="0">
        <tr>
            <td>
                <table width="440" border="0" align="center" bgcolor="#eeeeee" cellspacing="0" cellpadding="0">
                    <tr>
                        <td colspan="2" bgcolor="#ffffff">
                        <div align="center"><img src="images/2.gif" width="298" height="41" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">姓     氏</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="text" name="surname" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">名     字</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="frontname" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">身 份 证 号 码</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="text" name="sid" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">昵     称</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="nickname" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">性     别</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input name="gentle" type="radio" value="0" checked="checked" />
                                男 &nbsp;
                                <input name="gentle" type="radio" value="1" />
                                
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">生     日</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="birth" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">是 否 已 婚</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="radio" name="marriage" value="0" checked="checked" /> 否 &nbsp;
                                <input type="radio" name="marriage" value="1" /> 是
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">居 住 地 址</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="area" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">邮     编</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="text" name="zipcode" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">住     址</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="address" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">电     话</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <input type="text" name="phone" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">手 机 号 码</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="mobile" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div align="center">
                                <input type="reset" name="submit" value="清除重填" />
                                <input type="submit" class="box2" name="submit2" value="下一步" />
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>  
</form>
</body>
</html>



============================================================================================

第三个文件(registry3)代码

============================================================================================



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form name="regstep3" method="post" action="registry_do.php">
<input type="hidden" name="username" value="<?=$username?>">
<input type="hidden" name="userpass" value="<?=$userpass?>">
<input type="hidden" name="pass_rem" value="<?=$pass_rem?>">
<input type="hidden" name="pass_ans" value="<?=$pass_ans?>">
<input type="hidden" name="surname" value="<?=$surname?>">
<input type="hidden" name="frontname" value="<?=$frontname?>">
<input type="hidden" name="nickname" value="<?=$nickname?>">
<input type="hidden" name="gentle" value="<?=$gentle?>">
<input type="hidden" name="sid" value="<?=$sid?>">
<input type="hidden" name="birth" value="<?=$year."-".$month."-".$day?>">
<input type="hidden" name="marriage" value="<?=$marriage?>">
<input type="hidden" name="area" value="<?=$area?>">
<input type="hidden" name="zipcode" value="<?=$zipcode?>">
<input type="hidden" name="address" value="<?=$address?>">
<input type="hidden" name="phone" value="<?=$phone1."-".$phone2?>">
<input type="hidden" name="mobile" value="<?=$mobile?>">
<br />
<table width="446" border="1" bordercolor="#000000" align="center" cellspacing="0">
        <tr>
            <td>
                <table width="440" border="0" align="center" bgcolor="#eeeeee" cellspacing="0" cellpadding="0">
                    <tr>
                        <td colspan="2" bgcolor="#ffffff">
                        <div align="center"><img src="images/3.gif" width="298" height="41" /></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">教 育 程 度</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <select name="edu">
                                    <option value="硕士">硕士</option>
                                    <option value="博士">博士</option>
                                    <option value="研究生">研究生</option>
                                    <option value="大学本科">大学本科</option>
                                    <option value="大学专科">大学专科</option>
                                    <option value="高中">高中</option>
                                    <option value="中专">中专</option>
                                    <option value="中学">中学</option>
                                    <option value="小学">小学</option>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">职     业</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <select name="job">
                                    <option value="电子/通信">电子/通信</option>
                                    <option value="计算机">计算机</option>
                                    <option value="物理化工">物理化工</option>
                                    <option value="教育科学">教育科学</option>
                                    <option value="金融理财">金融理财</option>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">职     称</div>
                        </td>
                        <td height="18">
                            <div align="center">
                                <select name="title">
                                <option value="研究人员">研究人员</option>
                                <option value="电子工程师">电子工程师</option>
                                <option value="理财师">理财师</option>
                                <option value="教育家">教育家</option>
                                <option value="网络工程师">网络工程师</option>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#ffffff">
                            <div align="center">兴     趣</div>
                        </td>
                        <td height="18" bgcolor="#ffffff">
                            <div align="center">
                                <input type="text" name="interest" size="20" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div align="center">
                                <input type="reset" name="submit" value="清除重填" />
                                <input type="submit" name="submit2" value="提交" >
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>   
</form>
</body>
</html>


============================================================================================

第四个文件(registry_do.php)代码

============================================================================================



<?
    include("db_conn.php");
    include("db_func.php");
    
    //增加会员帐号/密码BEGIN
    $sqlstruser = "INSERT INTO member(m_username,m_userpass,m_userfrontname,m_sid,m_pass_rem,m_pass_ans)";
    $sqlstruser .= "VALUES('$username','MD5($userpass)','$pass_rem','$pass_ans')";
    db_query($sqlstruser);
    //增加会员帐号/密码END
    
    //增加会员基本信息BEGIN
    $sqlstrinfo = "INSERT INTO member_info (m_surname,m_frontname,m_id,m_nickname,m_gentle,m_birth,m_marriage,m_area,m_zipcode,m_address,m_phone,m_mobile)";
    $sqlstr = "VALUES('$surname','$frontname','$nickname','$gentle','$birth','$marriage','$area','$zipcode','$address','$phone','$mobile')";
    db_query($sqlstrinfo);
    //增加会员基本信息END
    
    //增加会员其他信息BEGIN
    $sqlstradd = "INSERT INTO member_add (m_edu,m_job,m_title,m_interest)";
    $sqlstradd .= "VALUES ('$edu','$job','$title','$interest')";
    db_query($sqlstradd);
    //增加会员其他信息END
?>

<script>
    alert("<?php echo "注册完成";?>");
    location.href = "registry1.php";
</script>






我提交后只能把第三个文件的信息写入数据库,前两个文件的信息不能写入数据库代码哪里有问题呢???
搜索更多相关主题的帖子: 数据库 单传 PHP 文件 registry 
2008-06-08 11:18
快速回复:PHP怎么处理多个页面表单传送过来数据问题 请教!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.063879 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved