PHP メーラーの 2 つの問題:
1 つ目 • メーラーは次の場合には機能しません。
<a class="button" href="javascript:" onClick="document.getElementById('form').submit()">SUBMIT</a>
• それはうまく動作するために使用します:
<input type="Submit" name="Submit" value="send" class="submitbutton"/>
ボタンを上記の入力に置き換えると、機能します。
ただし、これまでラジオボタンで使用したことはありません。フォームは送信されますが、ラジオボタンは処理されません。これは、この投稿のトラブル番号 2 です。スクリプトは、選択的なラジオボタンではなく、複数の代替チェックボックス用に作成されているようです。
送信ボタンとラジオボタンの両方に対応するには、何を変更する必要がありますか?
形
<form class="form-1" id="form" method="POST" action="php/subscription.php">
<input type="text" id="name">
<input type="text" id="phone">
<input type="text" id="email">
<input type="checkbox" name="check[ ]" value="iwhishtoreceivemailing" > WITH CHECKBOX VALUES ARE SUBMITTED
<input type="radio" name="check[ ]" id=""> ????????????? don´t know how to change the code for radiobuttons
<input type="text" id="message">
<a class="button" href="javascript:" onClick="document.getElementById('form').submit()">SUBMIT</a>
how to make it work with this php script ??
MAILER.PHP (php code is pasted below)
<?php
if(isset($_POST['Submit'])) {
$to = "anything@whatever.com ";
$to2 = "johndoe@jackfrost.com";
$subject = "contact_form";
$name = $_POST['visitor_name'];
$phone = $_POST['one'];
$email = $_POST['email'];
$message = $_POST['message'];
foreach( (array)$_POST['check'] as $value){
$check_msg .= "Checked: $value\n";
}
$body = "Name: $name\n phone: $phone\n Email : $email\n Mailing: $iwhishtoreceivemailing\n Message: $message\n";
header("Location: thankyoupage.html");
mail($to, $subject, $body );
mail($to2, $subject, $body);
} else {
echo "error_invalid_function";