0

phpbbフォーラムのカスタムログインページを作成しました。現在、ユーザーは「ユーザー名」と「パスワード」を入力します。私のユーザーの大多数は岩のように愚かなので、「username」入力ボックスを2つの「firstName」と「lastName」入力ボックスに変更しました。私がこれまでに持っているもの[これは.phpファイルです]:

<form action="./ucp.php?mode=login" method="post">
    <fieldset>
        <!-- my new input boxes -->
        <label for="username">First name:</label>&nbsp;
        <input type="text" name="firstname" id="firstname" size="10" title="Firstname" ><br><br>
        <label for="username">Last name:</label>&nbsp;
        <input type="text" name="lastname" id="lastname" size="10" title="Lastname" ><br><br>

        <!-- original input box; now hidden -->
        <label for="username">Username:</label>&nbsp;
        <input type="hidden" name="username" id="username" size="10" title="Username" />

        <label for="password">Password:</label>&nbsp;
        <input type="password" name="password" id="password" size="10" title="Password" />

        <br><label for="autologin">Log me on automatically each visit
        <input type="checkbox" name="autologin" id="autologin" /></label>

        <br><input type="submit" name="login" value="Login" />
    </fieldset>
</form>

「firstname」フィールドと「lastname」フィールドを連結して単一の「username」変数を作成する方法を知りたいです。私はjavascriptを使用しないソリューションを好みますが、簡単な代替手段がない場合は、それを採用すると思います。

4

3 に答える 3

0

.このようなphpでの連結に使用します

$user = $_POST['firstname'].$_POST['lastname'];

+javascriptで。

于 2012-10-09T07:40:07.780 に答える
0

onsubmitハンドラーでjavascriptを使用するか、ucp.phpをハックして名と姓を受け入れる必要があります。Javascriptには、変更を壊さずにphpBBをアップグレードできるという利点があります。以下のコードはテストされていません。

onsubmit="this.username.value=this.firstname.value+this.lastname.value; return true;";
于 2012-10-09T07:40:17.487 に答える
0

次の行を使用できます。

$lastname= $_POST['lastname']
$firstname= $_POST['firstname']
$username = lastname.' '.$lastname;

もちろん、これは上記の「./ucp.php」ではなく、アクションページで使用する必要があります。

于 2013-05-08T10:14:15.937 に答える