简体   繁体   English

php用户表单注册

[英]php user form registration

I designed a webpage. 我设计了一个网页。 One page contains an html user registration form: 一页包含html用户注册表格:

      <form action="internal/signup.php" method="post" name="signupform" id="signupform">
        <table width="444" border="0" cellspacing="6">
          <tr>
            <th width="98"align="right" scope="col"><label id="fnamelabel" for="fnam">First Name :</label></th>
            <th width="286" align="center" scope="col"><input type="text" name="fnam" id="fnam" tabindex="1" /></th>
            <td width="34" align="center" scope="col"><div id="ll"></div></td>
          </tr>
          <tr>
            <th align="right" scope="row"> <label id="lnamelabel"  for="lnam"> Last Name :</label></th>
            <td align="center"><input type="text" name="lnam" id="lnam" tabindex="2" /></td>
            <td align="center"><div id="lj"></div></td>
          </tr>
          <tr>
            <th align="right" scope="row"><label id="youremail" for="email">Your Email :</label></th>
            <td align="center"><input type="text" name="email" id="email" tabindex="3" /></td>
            <td align="center"><div id="lk"></div></td>
          </tr>
          <tr>
            <th align="right" scope="row"><label id="reemail" for="remail"> Password :</label></th>
            <td align="center"><input type="password" name="password" id="password" tabindex="4" /></td>
            <td align="center"><div id="ll2"></div></td>
          </tr>
          <tr>
            <th align="right" scope="row"><label id="npass" for="password">Re-Password:</label></th>
            <td align="center"><input type="password" name="repassword" id="repassword" tabindex="5" /></td>
            <td align="center"><div id="lm"></div></td>
          </tr>
          <tr>
            <th align="right" scope="row"><label id="skill" for="bskill">Skilled Area :</label></th>
            <td align="center"><select name="bskill" id="bskill" tabindex="6">
                <option>Graphics and multimedia</option>
                <option>Art Works</option>
                <option>IT &amp; programming</option>
              </select></td>
            <td align="center">&nbsp;</td>
          </tr>
          <tr>
            <th colspan="3" align="left" scope="row" id="terms">By clicking &quot;Sign up&quot;, you are indicating that you have read and agreed our <a href="index.html">Terms &amp; conditions.</a></label></th>
          </tr>
        </table>
<td align="center"><div id="signupbutton"></div></td>
        <td align="center">&nbsp; 
    </form>

When I click the signup button it goes to signup.php and completes the registration, but I need to redirect to the user's page after signup is completed. 当我单击注册按钮时,它将转到signup.php并完成注册,但是注册完成后,我需要重定向到用户页面。 (Similar to how Facebook or Twitter automatically direct to the user's page when the signup is completed) (类似于注册完成后Facebook或Twitter如何自动定向到用户页面)

Can anyone help me please? 谁能帮我吗?

Use header() after the registration is complete: 注册完成后使用header()

<?php
header('Location: users.php');
exit;
?>

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. 请记住,必须先通过常规HTML标记,文件中的空白行或从PHP发送任何实际输出,然后调用header()。

<?php
header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?> 
<?php
// Redirect the user to wherever you want to go
header("Location: /users.php");

// Make sure none of the code beneath here is executed
die();
?>

This code must be sent before any content is. 必须在发送任何内容之前发送此代码。

More documentation can be found here: http://es.php.net/manual/en/function.header.php 可以在这里找到更多文档: http : //es.php.net/manual/en/function.header.php

Use header() . 使用header()

Remember to use die() or exit() after header() . 请记住在header()之后使用die()exit() header() If you don't use one of them, your code will continue executing after redirection. 如果您不使用它们之一,则代码将在重定向后继续执行。

header() must be used before any output . 必须在任何输出之前使用header()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM