問い合わせフォームを
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <title>お問い合わせメールフォーム</title> <link href="css/shop_form.css" rel="stylesheet" type="text/css" /> <link href="css/shop_list.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contents"> <h2>お問い合わせメールフォーム</h2><br /><br /> <h3>*お問い合わせ先の情報を入力してください*</h3><br /> <h3>*ご回答は、翌営業日となります*</h3><br /> <form method="post" action="shop_form_check.php"> お名前(必須)<br /> <input type="text" name="onamae" style="width:200px"><br /><br /> メールアドレス(必須)<br /> <input type="text" name="email1" style="width:200px"><br /><br /> <h3>確認のため、もう一度入力したください(必須)</h3><br /><br /> <input type="text" name="email2" style="width:200px"><br /><br /> <h3>お問い合わせ内容(必須)</h3><br /><br /> <textarea name="inquiry" style="width:500px;" rows="20"></textarea><br /><br /> <h3>性別(任意)</h3><br /><br /> <input type="radio" name="sex" value="man" checked>男性<br /> <input type="radio" name="sex" value="woman">女性<br /><br /> <h3>生まれ年(任意)</h3><br /><br /> <select name="birth"> <option value="1910">1910年代</option> <option value="1920">1920年代</option> <option value="1930">1930年代</option> <option value="1940">1940年代</option> <option value="1950">1950年代</option> <option value="1960">1960年代</option> <option value="1970">1970年代</option> <option value="1980" selected>1980年代</option> <option value="1990">1990年代</option> <option value="2000">2000年代</option> <option value="2010">2010年代</option> </select><br /><br /> <input type="submit" style="width:80px"; value="確認" class="mystyle"> <input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br /> <h3><a href="../index.html">TOPへ戻る</a></h3> </form> </div> </body> </html> と記述して、入力のチェックを <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <title>問い合わせチェック</title> <link href="../css/cart_look.css" rel="stylesheet" type="text/css" /> <link href="css/shop_list.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contents"> <?phprequire_once('../common/common.php');
$post=sanitize($_POST);
$onamae= $post['onamae'];
$email1= $post['email1'];
$email2= $post['email2'];
$sex= $post['sex'];
$birth= $post['birth'];
$inquiry= $post['inquiry'];
$okflg=true;
if ($onamae=='')
{
$okflg=false;
print 'お名前が未入力です。<br /><br />';
}
if ($email1=='')
{
$okflg=false;
print 'メールアドレスが未入力です。<br /><br />';
}
if ($email1!=$email2)
{
$okflg=false;
print '<h3>メールアドレスが確認用のメールアドレスと一致しません</h3><br />';
}
elseif (preg_match('/^[\w-.]+@[\w-.]+.([a-z]+)$/',$email1)==0)
{
$okflg=false;
print 'メールアドレスに誤りがあります。<br /><br />';
}
if ($inquiry=='')
{
$okflg=false;
print 'お問い合わせ内容が未入力です。<br /><br />';
}
if ($okflg==false)
{
print '<form>';
print '<input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br /><input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br /><input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br /><input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br /><input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br />';
print '</form>';
}
else
{
print '<h3>お問い合わせ情報の確認</h3><br /><br />';
print '<h3>お名前</h3><br />';
print $onamae.'様';
print '<br /><br />';
print '<h3>Eメールアドレス</h3><br />';
print $email1;
print '<br /><br />';
print '<h3>お問い合わせ内容</h3><br />';
print nl2br($inquiry);
print '<form>'; print '<input type="button" onclick="history.back()" style="width:40px"; value="戻る" class="mystyle"><br />'; print '</form>'; print '<form method="post" action="shop_form_done.php">'; print '<input type="hidden" name="onamae" value="'.$onamae.'">'; print '<input type="hidden" name="email1" value="'.$email1.'">'; print '<input type="hidden" name="inquiry" value="'.$inquiry.'">'; print '<input type="hidden" name="sex" value="'.$sex.'">'; print '<input type="hidden" name="birth" value="'.$birth.'">'; print '<input type="submit" style="width:80px"; value="確認して送信" class="mystyle">'; print '<form>'; }
?>
</body> </html> と書いたのですが、チェック項目に引っかかった時に表示される「戻る」ボタンが1つではなく5つも表示されてしまいます。 どうやって直したらよいのか教えていただけませんでしょうかお願いいたします。</div>

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。