php邮件表单不发送邮件

我似乎对我正在制作的电子邮件表单有疑问.
表单正常工作,直到我添加了一些额外的部分.然而,即使我评论我的更改,它也行不通.
我认为问题可能是由于某些语法错误,但似乎并非如此.
我没有收到任何错误消息
下面是我的代码:

<?php
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 />"."<br />".$noml."<br/>".$sphl."<br/>".$cyll."<br/>".$angl."<br />".$addl."<br />".$dial."<br />".$desc."<br />".$type."<br />".$matter."<br />".$color."<br />";
    $email='info@toosoptic.ir';
    $headers='MIME-Version: 1.0'."\r\n";
    $headers.='Content-type: text/html; charset=iso-8859-1'."\r\n";
    mail("mail@example.com",$subject,$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' 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='تایید اطلاعات'/>";
}
?>

解决方法:

您还没有在提交按钮中定义名称:

 <input type='submit' id='sb' value='ارسال اطلاعات' />

用以下代码替换上面的代码:

 <input type='submit' id='sb' name='email' value='ارسال اطلاعات' />

您正在检查代码if(isset($_ REQUEST [’email’]))并且我看到表格中没有电子邮件字段.

基本上,此检查用于验证表单是否已提交(通常是其他方式).因此,您需要在提交按钮属性中添加name =’email’以执行if条件代码.

相关文章

文章浏览阅读8.4k次,点赞8次,收藏7次。SourceCodester Onl...
文章浏览阅读3.4k次,点赞46次,收藏51次。本文为大家介绍在...
文章浏览阅读1.1k次。- php是最优秀, 最原生的模板语言, 替代...
文章浏览阅读1.1k次,点赞18次,收藏15次。整理K8s网络相关笔...
文章浏览阅读1.2k次,点赞22次,收藏19次。此网络模型提供了...
文章浏览阅读1.1k次,点赞14次,收藏19次。当我们谈论网络安...