但是,我在每个变量的每一行上都得到未定义的索引错误。
PHP Notice: Undefined index: name in /path/to/file.php on line 2
形式:https://jsfiddle.net/dg1ur9fc/
PHP:
<?php
/* Error Reporting */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST)){
$name = $_POST['fullname'];
$number = $_POST['number'];
$email = $_POST['email'];
$brand = $_POST['brand'];
$model = $_POST['model'];
$variant = $_POST['variant'];
$screen = $_POST['screen'];
$body = $_POST['body'];
$power = $_POST['power'];
$battery = $_POST['battery'];
$charge = $_POST['charge'];
$calls = $_POST['calls'];
$fcamera = $_POST['fcamera'];
$rcamera = $_POST['rcamera'];
$water = $_POST['water'];
$wifi = $_POST['wifi'];
$formcontent = "From: $name \n Contact: $number \n Device Brand: $brand \n Device Model: $model \n Device Variant: $variant \n Screen: $screen \n Housing: $body \n Is your device able to power on? $power \n Does your device have a fault battery? $battery \n Is your device able to charge? $charge \n Does your front camera work? $fcamera \n Does your rear camera work? $rcamera \n Is your device water damaged? $water \n Is your device able to connect using WiFi? $wifi";
$recipient = "test@example.com";
$subject = "Buyback Request";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader);
/* Redirect browser */
header("Location: https://example.com");
/* Make sure that code below does not get executed when we redirect. */
exit;
}
?>
请问这个问题是什么以及如何解决?谢谢。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。