簡體   English   中英

php用戶表單注冊

[英]php user form registration

我設計了一個網頁。 一頁包含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>

當我單擊注冊按鈕時,它將轉到signup.php並完成注冊,但是注冊完成后,我需要重定向到用戶頁面。 (類似於注冊完成后Facebook或Twitter如何自動定向到用戶頁面)

誰能幫我嗎?

注冊完成后使用header()

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

請記住,必須先通過常規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();
?>

必須在發送任何內容之前發送此代碼。

可以在這里找到更多文檔: http : //es.php.net/manual/en/function.header.php

使用header()

請記住在header()之后使用die()exit() header() 如果您不使用它們之一,則代碼將在重定向后繼續執行。

必須在任何輸出之前使用header()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM