好的,所以我为我的联系表单创建了php文件,这是我的php代码(我已经删除了我的电子邮件):
<?php
/* Subject and Email Variables */
$emailSubject = 'CV Website!';
$email_to = '-----------';
/* Gathering Data Variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$messageField = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Message: $message <br>
EOD;
$headers = "From: $email\r\n";
$headers .="Content-type: text/html\r\n";
$success = mail($email_to, $emailSubject, $body, $headers);
以下是与之相关的表格:
<form action="process.php" id="contact_form" method="post" class="wow
fadeInUpBig" data-wow-offset="80" data-wow-duration="2s">
<p>
<label>Name</label>
<input type="text" name="name" id="name" value="" class="requiredField name" />
</p>
<p>
<label>Email Address</label>
<input type="text" name="email" id="email" value="" class="requiredField email" />
</p>
<p>
<label>Your Message</label>
<textarea name="message" id="message" rows="8" cols="30" class="requiredField message"></textarea>
</p>
<p>
<input name="submitted" id="submitted" value="Submit" class="submit" type="submit" />
</p>
</form>
当我测试表单时,我得到的是这样的消息:
姓名:
电子邮件:
消息:
没有输入数据,如果你看到iv做错了,请帮忙。提前致谢
答案 0 :(得分:0)
首先,你应该尝试这个,然后根据需要进行更改:
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$messageField = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br>
Message: $messageField <br>
EOD;
$headers = "From: $emailField\r\n";
$headers .="Content-type: text/html\r\n";
$success = mail($email_to, $emailSubject, $body, $headers);
答案 1 :(得分:0)
我只是猜测你的表格需要这个标签:
<form method="post" ... >
... <!-- Input Fields go here -->
</form>