0

ウェブページをデザインしました。1 つのページには、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 が自動的にユーザーのページに移動するのと同様)

誰でも私を助けてもらえますか?

4

3 に答える 3

4

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;
?> 
于 2012-07-10T16:34:09.657 に答える
2
<?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

于 2012-07-10T16:35:06.003 に答える
2

を使用しheader()ます。

die()または のexit()後に使用することを忘れないでくださいheader()。それらのいずれも使用しない場合、コードはリダイレクト後も実行を続けます。

header()出力の前に使用する必要があります。

于 2012-07-10T16:38:19.030 に答える