我尝试使用HTML表单发送包含PHP的电子邮件。
但是,当我收到电子邮件时,姓名和电子邮件字段始终为空,我只收到该消息。
这是表格代码:
SELECT *
FROM tablename a
RIGHT OUTER JOIN tablename b ON b.subcat_id =1
AND a.subcat_id = b.subcat_id
WHERE a.subcat_id = 8
GROUP BY a.client_id
和PHP代码:
<form class="form" id="contact" action="form-to-email.php" method="post">
<input class="name" type="text" id="name" placeholder="Name" required>
<input class="email" type="email" id="email" placeholder="Email" required>
<input class="phone" type="text" id="phone" placeholder="Phone No:">
<textarea class="message" name="message" id="message" cols="30" rows="10" placeholder="Message" required></textarea>
<input class="submit-btn" id="submitbtn" type="submit" value="SUBMIT">
</form>
答案 0 :(得分:3)
<input class="name"...
错误,应为<input name="WHATEVER"
输入上的name
属性是您引用表单值的原因。
答案 1 :(得分:1)
您需要在$fs = fsockopen("website", 80);
if (!$fs) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fs, $req.$bdy);
while(!feof($fs)) {
$GLOBALS['s'] = fgets($fs);
}
}
fclose($fs);
$attr = $GLOBALS['s']->attributes(); // THIS DOES NOT WORK
echo $attr['Day date']; // I CANNOT GET VALUE HERE
代码中添加name
个属性,例如:
input
您可以在此处阅读更多内容:http://www.html-form-guide.com/contact-form/php-email-contact-form.html