简体   繁体   中英

Form not submitting html

I am trying to get an simple email form to work. It is not responding to my submit button. What did I do wrong or is there something I left out?

                            <?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';
}

在此处输入图片说明

表单中包括您的提交字段。

Your submit button it outside the form. Please try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM