我正在尝试使用简单的电子邮件表单。 它没有响应我的提交按钮。 我做错了什么或者我遗漏了什么?
<?php
if($error == 'ja')
{
// maak random getallen voor anti spam
$spam_1 = rand(1,10);
$spam_2 = rand(1,10);
$spam = 'Anti spam beveiliging, wat is het antwoord op deze som: '.$spam_1.' + '.$spam_2.' =';
?>
<form method="post" action="?">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="Name" <?php if($error_name == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> /></div>
<div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="Email" <?php if($error_email == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> /></div>
<div class="12u$"><textarea name="message" id="message" placeholder="Message" rows="4" <?php if($error_message == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> ></textarea></div>
</div>
</form>
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
</ul>
</div>
</form>
<?php
}
?>
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
echo 'working';
}
答案 0 :(得分:4)
在表单中包含您的提交字段 。
答案 1 :(得分:0)
您在表单外的提交按钮。请试试这个:
<form method="post" action="?">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="Name" <?php if($error_name == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> /></div>
<div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="Email" <?php if($error_email == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> /></div>
<div class="12u$"><textarea name="message" id="message" placeholder="Message" rows="4" <?php if($error_message == 'ja') {echo 'style="border:1px solid #E41C2E"';} ?> ></textarea></div>
</div>
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
</ul>
</form>