php邮件的两个问题:
第一个 •梅勒不适用于:
<a class="button" href="javascript:" onClick="document.getElementById('form').submit()">SUBMIT</a>
•它适用于:
<input type="Submit" name="Submit" value="send" class="submitbutton"/>
如果我用上面的输入替换了按钮,那么它就能正常工作。
但是我之前从未使用过无线电按钮:提交了表格,但是没有处理无线电按钮,这是本文中的第2个故障; 该脚本似乎是为多个替代复选框创建的,而不是为选择性单选按钮创建的。
必须更改什么才能容纳提交按钮和单选按钮?
FORM
<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";
答案 0 :(得分:2)
而不是:
if(isset($_POST['Submit'])) {
做:
if(isset($_POST['email'])) {
因为名称为Submit
的提交按钮不再存在