我從未有過這個問題,但我希望別人有。我有一個php郵件腳本,不會在我的頁面上工作。它甚至不會讓你在文本框中輸入文本。其中一個選擇是選擇,你甚至不能使下拉工作。整個事情是完全不可修改的。由於... CSS不可編輯的PHP郵件格式文本框?
我可以採取相同的確切代碼,並將其放在一個裸露的骨骼HTML文件,它的一切工作只是找到。正確發送郵件,一切正常。
所以很明顯,在我的網頁或我的CSS文件中,有一些東西完全殺死了HTML表單,導致它無用。
這裏是表單代碼:
<form action="contact.php" method="post">
<table>
<tr>
<td><b>Your Name:</b></td>
<td> <input type="text" name="yourname" /></td>
</tr>
<tr>
<td><b>Subject:</b> </td>
<td><select name="subject" />
<option value=""> -- Please select -- </option>
<option>Prayer Requests</option>
<option>Praise Report</option>
<option>General Feedback</option>
</select></td>
</tr>
<tr>
<td><b>E-mail:</b> </td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td><b>Your comments:</b></td>
<td><textarea name="comments" rows="10" cols="40"></textarea><td></tr></td>
<tr>
<td><input type="submit" value="Send it!"></td>
</tr>
</table>
</form>
下面是PHP腳本:
<?php
/* Set e-mail recipient */
$myemail = "[email protected]";
/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your name");
$subject = check_input($_POST['subject'], "Write a subject");
$email = check_input($_POST['email']);
$website = check_input($_POST['website']);
$likeit = check_input($_POST['likeit']);
$comments = check_input($_POST['comments'], "Write your comments");
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}
/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
$website = '';
}
/* Let's prepare the message for the e-mail */
$message = "Hello!
Your contact form has been submitted by:
Name: $yourname
E-mail: $email
URL: $website
Comments:
$comments
End of message
";
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
header('Location: thanks.htm');
exit();
/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>
我可以張貼的CSS,如果我需要。有沒有人聽說過這樣做的郵件表單?
如果有幫助,以下是指向網頁的鏈接。
這是光禿禿的骨頭頁面表單工作正常上: Working test page
這是我想要得到它的工作在我接觸的頁面,它不會: non-working actual page
在這一點上我會很感激的任何信息,因爲我已經砰的一聲撞在自週四晚上這堵牆,我的頭好痛...... LOL
那麼,那簡直是愚蠢的!大聲笑!謝謝Duopixel,我已經看過那個頁面,直到它們全部一起運行。即使昨晚使用開發工具,但沒有看到它..樹/太多咖啡......誰知道。再次...感謝! – Ren