私は Twitter Bootstrap を利用して概念を構築しようとしている初心者プログラマーです。私は PHP を使用しており、HTML タグ内のアクションを POST データに割り当てており、基本的にユーザーをナビゲーションに連れて行きます。フォームを使用する場合、これは非常に簡単です。つまり、これは機能するスニペットです。たとえば、次の HTML スニペットの場合:
<form action="?viewnotes" method="post">
<input type="hidden" name="id" value="<?php htmlout($note['id']); ?>">
</form>
私のindex.phpで次のifステートメントを正常にトリガーします。
if (isset($_GET['viewnotes']))
ただし、ボタンに Twitter Bootstrap クラスを使用して、登録ページで同じことをしようとしています。HTMLは次のとおりです。
<a class="btn btn-primary btn-large" action="?register">Sign Up Free!»</a></p>
PHPコードは次のとおりです。
if (isset($_GET['register']))
{
include 'register.html.php';
}
[サインアップ] ボタンをクリックしても、PHP コードが呼び出されません。URL をハードコーディングすると機能しますが、register.html.php ページで同様の問題が発生します。登録ページの HTML には次のものがあります。
<form class="form-horizontal" action="?storeuser" method="post">
<fieldset>
<legend>It's quick and easy...</legend>
<div class="control-group">
<label class="control-label">First Name</label>
<div class="controls">
<input type="text" name="fname" class="input-xlarge" id="fname">
</div>
</div>
<div class="control-group">
<label class="control-label" name="lname">Last Name</label>
<div class="controls">
<input type="text" name="lname" class="input-xlarge" id="lname">
</div>
</div>
<div class="control-group">
<label class="control-label" name="email">Email Address</label>
<div class="controls">
<input type="text" name="email" class="input-xlarge" id="email">
</div>
</div>
<div class="control-group">
<label class="control-label" name="password">Password</label>
<div class="controls">
<input type="password" name="password" class="input-xlarge" id="password">
</div>
</div>
</fieldset>
<button type="submit" name="action" class="btn btn-primary btn-large">Complete Registration</button>
</form>
ただし、ボタンをクリックすると、インデックス ファイルは、フィールドを DB に格納する次の処理をトリガーしません。
if (isset($_GET['storeuser']))
URL を register.html.php にハードコードすると、結果の URL は localhost/?storeuser ではなく、localhost/register.html.php?storeuser のようになります。それがここでの動作に影響を与えているかどうかはわかりません。
お手伝いありがとう!