-2
私はフォームにはいといいえボタンを追加する方法を知らないので、ユーザーが送信ボタンを押して送信ボタンを押すと、データはサーバー側から返送されますスクリプトを実行してユーザーに返し、ユーザーは情報を承認するために「はい」または「いいえ」ボタンをクリックします。あなたは、単にyesまたはnoボタンをしたい場合は[はいプログラムは感謝フォームにはいといいボタンが必要です。情報が正しい場合、はいをクリックしていただきありがとうございます
<html>
<head>
<title>Test1-1</title>
</head>
<body>
<?php
if (filter_has_var(INPUT_POST, "name")){
$name = filter_input(INPUT_POST, "name");
print "<p>Hi $name, </p>";
}
if (filter_has_var(INPUT_POST, "id")){
$id = filter_input(INPUT_POST, "id");
print "<span>Your Employee ID is $id</span>";
}
if (filter_has_var(INPUT_POST, "office")){
$office = filter_input(INPUT_POST, "office");
print "<span>, your office is room $office</span>";
}
if (filter_has_var(INPUT_POST, "os")){
$os = filter_input(INPUT_POST, "os");
print "<span>, and your OS is $os</span>";
}
else {
//there's no input. Create the form
print <<< HERE
<form action ="" method = "post">
<fieldset>
<label>Enter your name</label>
<input type = "text"
name = "name"/><br>
<label>Employee ID</label>
<input type = "text"
name = "id"/><br>
<label>Office Room Number</label>
<input type = "text"
name = "office"/><br>
<label>Oberating System on the Office Computer</label>
<input type = "text"
name = "os"/><br>
<button type = "submit">
submit
</button>
</fieldset>
</form>
HERE;
}// end 'value exists' if
?>
</body>
</html>
簡単なHTMLを必要としますサーバー側のコードにフォームデータを送信し、htmlを返すと、ユーザーはyes/noボタンを表示します。そこから、yes/noをクリックすると何が起こるかを処理するために、さらにAjaxコードが必要になります。 –