ページ「index.php」にphpでフォームを作成しています。ページが読み込まれると、次のフォームが作成されます。
if($_SERVER['REQUEST_METHOD']!='POST')
{
echo '
<form action="index.php" method="POST">
<fieldset style="width: 700px;">
<legend>Enter your search below</legend>
<textarea rows="1" cols="80" name="query">
</textarea>
</fieldset>
<p>
<input type="radio" value="Non-Aggregated"> Non-Aggregated
<input type="radio" value="Aggregated"> Aggregated
<input type="submit" value="Search">
</p>
</form>';
}
ユーザーが送信ボタンをクリックすると、適切なコンテンツが表示されます。
else
{
if ($_POST['query'])
{
//content displayed after form submission
}
}
フォームに戻り、ラジオ オプションに注意してください。
<input type="radio" value="Non-Aggregated"> Non-Aggregated
<input type="radio" value="Aggregated"> Aggregated
非集約または集約がラジオ ボタンから選択されているかどうかに基づいて、異なるアクションを実行するために if ステートメントに配置できる条件はありますか? もしそうなら、どうすればこれを行うことができますか?
助けてくれてありがとう。