gpt4 book ai didi

由于...CSS,PHP 邮件表单文本框无法编辑?

转载 作者:太空宇宙 更新时间:2023-11-04 00:12:28 24 4
gpt4 key购买 nike

我以前从未遇到过这个问题,但我希望其他人遇到过。我有一个无法在我的页面上运行的 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 = "feedback@the-ecclesia.org";

/* 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

在这一点上,我很感激任何信息,因为自从周四晚上以来我一直在撞墙,我的头很痛......大声笑

最佳答案

您需要清除容器中的浮子...

.container {
width: 980px;
position: relative;
margin-left: auto;
margin-right: auto;
clear: both;
}

现代浏览器集成了一些工具,可让您检查 HTML 和 CSS 的运行情况。在 Chrome 中,它是查看 > 开发人员 > 开发人员工具。 Firebug 是 Firefox 的一个很好的插件,Opera 有 Dragonfly。使用这些工具,只需 3 秒即可找到问题(您的底部容器挡住了表单),有了这些信息,可以更轻松地解决任何渲染问题。

关于由于...CSS,PHP 邮件表单文本框无法编辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12549195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com