Question

I'm trying to build a php contact form (to be used into a wordpress custom page) that show a different "thank you message" based on the checkbox selection.

There will be three checkbox, every checkbox in used will make appear a download link under the "thank you" message.

<form method="post" action="php/contact-send.php" id="contact_form">
    <p><label class="form_label" for='form_name'>Name</label>
    <input id='form_name' type='text' name='name' class="textbox" value='' /></p>

    <p><label class="form_label" for='form_email'>E-mail</label>
    <input id='form_email' type='text' name='email' class="textbox" value='' /></p>

    <p>Download1 <input id='form_name' type='checkbox' name='Download1' class="textbox" value='Download1' /></p>

    <input id='form_submit' type='submit' name='submit' value='Send message' />

    <!-- To Email -->
    <input id='to_email' type='hidden' name='to_email' value='<?php echo "";?>' />

    <!-- hidden input for basic spam protection -->
    <div class='hide'>
        <label for='spamCheck'>Do not fill out this field</label>
        <input id="spamCheck" name='spam_check' type='text' value='' />
    </div>                  
</form> 
<!-- contact form ends here-->  

<!-- This div will be shown if mail was sent successfully -->       
<div class="hide success">
<p><?php echo thanks_message;?></p>

<p>
<?php
if(isset($_POST['Download1'])) {
// The checkbox was enabled...
echo "Link download 1";}

else { echo "much wrong, wow";} 
?>
</p>

The problem is i can't get it to work and detect when the first checkbox is selected, it alway give me the else message even if i select it. I'm kinda new with php and i don't really get what i'm doing wrong,

Thanks in advance for any help

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top