2

I'm new at php and I know this is simple but I can not figure what I've done wrong. No matter what I try I can't get the 'event' variable to pass into the email.

-HTML-

<div class="container">
<form class="form-inline" role="form" method="post" action="this.php">
            <div class="form-group">
        <div>
            <label for="event">What Kind of Event is it?</label><br>
                     <!--<select name="Event" tabindex="1">-->
                    <select class="form-control" id="inputEvent">
                        <option value="0">0</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                    </select>
            </div>
                <br>
                    <br>
                <div class="form-group">
                <input type="text" class="form-control" 
          id="inputEmail" name="inputEmail" placeholder="Your Email">
            </div><br><br>
        <div class="form-group">
            <label for="human" control-label>Are you human? 2 + 3 = 
                                                       ?</label><br>
            <input type="text" class="form-control" id="human" 
                             name="human" placeholder="Your Answer?">
           </div>
            <br><br>
            <div class="form-group">
            <button type="submit" class="btn btn-default"   
                                                      value="Filter">
        Send Message
    </button>
            </div>
        </form>        
</div>

this.php

 <?php
$event = $_POST['inputEvent'];
$email = check_input($_POST['inputEmail'], "Your E-mail Address");

Email: $email
Event: $event
?>

1 Answer 1

3

It can be confusing but you need to use the "name" attribute rather than the "id" attribute. Try changing your form to:

            <select class="form-control" name="inputEvent">
                <option value="0">0</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
            </select>
1
  • Thanks for getting back to me, but that didn't work. I still get nothing pasted for 'inputEvent. I am only looking for one value for the drop down menu to be past. Nothing I try, posts the variable. I can't even get echo to work. :(
    – CyberD
    Sep 6, 2015 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.