php邮件表单不发送电子邮件,导致404错误

时间:2014-03-01 15:56:08

标签: php html

我的php邮件表单在本地主机中正常工作(它当然不发送任何内容,但没有显示错误)。然而,当我上传它时,单击提交按钮会导致打开404页面作为新选项卡。当我把它发送空时,没有错误。但如果我把数据放进去,我就会收到错误 这是代码:

if (isset($_REQUEST['email']))
    {
        $num = $_REQUEST['num'] ;
        $desc = $_REQUEST['desc'];
        $subject = "einak";
        $nomr = $_REQUEST['nomr'] ;
        $sphr = $_REQUEST['sphr'] ;
        $cylr = $_REQUEST['cylr'] ;
        $angr = $_REQUEST['angr'] ;
        $addr = $_REQUEST['addr'] ;
        $diar = $_REQUEST['diar'] ;
        $noml = $_REQUEST['noml'] ;
        $sphl = $_REQUEST['sphl'] ;
        $cyll = $_REQUEST['cyll'] ;
        $angl = $_REQUEST['angl'] ;
        $addl = $_REQUEST['addl'] ;
        $dial = $_REQUEST['dial'] ;
        $type = $_REQUEST['type'] ; 
        $matter = $_REQUEST['matter'] ;
        $color = $_REQUEST['color'] ;
        $message = $num .  "<br />" . $nomr . "<br/>" . $sphr . "<br/>" . $cylr . "<br/>" . $angr . "<br />" . $addr . "<br />" . $diar . "<br />" . $noml . "<br/>" . $sphl . "<br/>" . $cyll . "<br/>" . $angl . "<br />" . $addl . "<br />" . $dial . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . "0" . "<br />" . $desc . "<br />"  . "<br />" . $type . "<br />" . $matter . "<br />" . $color . "<br />";
        $email = '';
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $email= '';
        mail ( "" , $email , $message , $headers ) ;
        echo "ارسال شما موفقیت آمیز بود";
    }
else
    {
      echo "<form method='post'>
                <input name='num' id='num' type='text' /> <br />
                <input type='text' name='nomr' id='nomr' > <br />
                <input type='text' name='sphr' id='sphr'> <br />
                <input type='text' name='cylr' id='cylr'  > <br />
                <input type='text' name='angr' id='angr'  > <br />
                <input type='text' name='addr' id='addr'  > <br />
                <input type='text' name='diar' id='diar' > <br />
                <input type='text' name='noml' id='noml' > <br />
                <input type='text' name='sphl' id='sphl'> <br />
                <input type='text' name='cyll' id='cyll'  > <br />
                <input type='text' name='angl' id='angl'  > <br />
                <input type='text' name='addl' id='addl'  > <br />
                <input type='text' name='dial' id='dial' > <br /> 
                <textarea id='desc' name='desc'> </textarea>          
                <input name='type' type='radio' value='bifocal' id='type1' />
                <input name='type' type='radio' value='progres' id='type2' />
                <input name='type' type='radio' value='single' id='type3' />
                <input name='type' type='radio' value='decen' id='type4' />
                <input name='matter' type='radio' value='glass' id='mat1' />
                <input name='matter' type='radio' value='plastic' id='mat2' />
                <input name='color' type='radio' value='single' id='col1' />
                <input name='color' type='radio' value='decen' id='col2' /> 
                <input type='submit' name='email' id='sb' value='ارسال اطلاعات' />
                <input type='text' name='name' id='name'  > <br />
                <input type='add' name='address' id='address'  > <br /> 
            </form >
            <p id='confirmation'></p>
            <input  type='submit'  id='vis' onClick='vis(); return false;'  value='تایید اطلاعات'/>";
    }


感谢
编辑:如果你想在这里看到的是链接http://toosoptic.ir/%D9%81%D8%B1%D9%85-%D8%B3%D9%81%D8%A7%D8%B1%D8%B4-%D8%A2%D9%86%D9%84%D8%A7%DB%8C%D9%86/

2 个答案:

答案 0 :(得分:1)

缺少操作页面!你应该在action属性中提供php页面。

<form action="yourpage.php" method="post">

答案 1 :(得分:0)

mail命令的第一个参数是“to”地址。你要把它留空。见http://nl3.php.net/manual/en/function.mail.php