电子邮件表单的PHP问题

电子邮件表单的PHP问题,php,email,Php,Email,我曾经成功地使用过这个网站,我也遇到过类似的php电子邮件表单问题。我试着从以前的表格中复制,这个网站上的人对我想要的工作方式非常有帮助,但由于某种原因,它不会发送表格。我相信这是一个愚蠢的疏忽,但我希望能再看一眼 代码如下: <?php $state = 0; // check to see if verificaton code was correct if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verificatio

我曾经成功地使用过这个网站,我也遇到过类似的php电子邮件表单问题。我试着从以前的表格中复制,这个网站上的人对我想要的工作方式非常有帮助,但由于某种原因,它不会发送表格。我相信这是一个愚蠢的疏忽,但我希望能再看一眼

代码如下:

<?php
$state = 0;
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
mail("myemailaddress@hotmail.com", 'Website Inquiry: '.$subject, "\n".$comments." 
\n\n".$name."\n\n".$company."\n\n".$email."\n\n".$_SERVER['REMOTE_ADDR']."\n\n".'InterestedIn: '.$InterestedIn, "\n\n".'ContactMethod: '.$ContactMethod,"From: $email");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
$state = 2;
} else if(isset($message) and $message!=""){
// if verification code was incorrect then return to contact page and show error
$state = 1;
}

if ($state == 0) {  ?>
<form action="" method="post" name="form1" id="form1" 

onsubmit="MM_validateForm('email','','RisEmail','name','','R','verif_box','','R')

;return document.MM_returnValue">

 <p><strong>Tell us what you're interested in:</strong></p>
<dl>
    <dd><input type="radio" name="InterestedIn" value="BIBS<?php echo $_GET['InterestedIn'];?>"> Blow-In-Blanket System
    <input type="radio" name="InterestedIn" value="Foam<?php echo $_GET['InterestedIn'];?>"> Soya Spray Foam
    <input type="radio" name="InterestedIn" value="Attic<?php echo $_GET['InterestedIn'];?>"> Attic Insulation
    <input type="radio" name="InterestedIn" value="NotSure<?php echo $_GET['InterestedIn'];?>" checked="checked"> Not Sure</dd>
</dl>
<p><strong>Enter additional comments in the space provided below:</strong></p>
<dl>
    <dd><textarea name="comments" cols="50" rows="5" border="0" id="comments"><?php echo $_GET['comments'];?></textarea></dd>
</dl>
<p><strong>Tell us how to get in touch with you:</strong></p>
<dl>
    <dd>
    <table>
        <tr>
            <td>Name*</td>
            <td>
            <input type="text" size="40" maxlength="256" name="Name" value="<?php echo $_GET['name'];?>"></td>
        </tr>
        <tr>
            <td>Company</td>
            <td>
            <input type="text" size="40" maxlength="256" name="Company" value="<?php echo $_GET['company'];?>"></td>
        </tr>
        <tr>
            <td>Email*</td>
            <td><input type="text" size="40" maxlength="256" name="email" value="<?php echo $_GET['email'];?>"></td>
        </tr>
        <tr>
            <td>Phone</td>
            <td><input type="text" size="40" maxlength="256" name="Phone" value="<?php echo $_GET['phone'];?>"></td>
        </tr>
        <tr>
            <td>City</td>
            <td><input type="text" size="40" maxlength="256" name="City" value="<?php echo $_GET['city'];?>"></td>
        </tr>
    </table>
    </dd>
</dl>
    <p><strong>Best method to get in touch with you:</strong></p>

<dl>
    <dd><input type="radio" name="ContactMethod" value="byphone<?php echo $_GET['InterestedIn'];?>" checked="checked">  Phone
    <input type="radio" name="ContactMethod" value="byemail<?php echo $_GET['InterestedIn'];?>"> Email
    </dd>
</dl>

   <dl><dd><img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="top"/>&nbsp;&nbsp;<input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:80px; height:14px;"/><br /><br />
Enter Verification Image

</dd></dl>


<p style="padding-left:60px;"><input type="submit" class="button primary" value="Submit Form" name="submit"/>
<input type="reset" class="button primary" value="Clear Form" name"clear" /></p>
</form>

告诉我们您对什么感兴趣:

告诉我们如何与您联系:

名字*
我认为一些基本的调试会有很大帮助

  • 您似乎将
    $\u GET
    方法class='post'

  • 尝试使用一行脚本,该脚本仅使用硬编码值调用
    mail()
    。这样行吗

  • 试着提交你的表格。输出
    $\u POST
    。它有你期待的一切吗?
    $\u COOKIE

  • 提前构造要传递到
    邮件中的所有字符串。他们看起来都像是应该的吗

  • 尝试将这些字符串直接放入
    mail()
    (如上面的#2)。这样行吗


  • 当您到达此列表的末尾时,您将知道故障所在,并可以得到更具体的答案。

    您从不填充cookie,您应该使用会话anyway@DaveRandom-既然你帮我复制了这张表的原始表格,你知道为什么这张不起作用吗?我在代码中遗漏了什么吗?它看起来和我做的另一个一样。php是我的周积分,你能用lamens的术语给我解释一下吗?我不知道如何核实你的建议。如果我能让它发送,从那里我可以排除故障,让它看起来像我想在电子邮件中。