php variable question

by coog
3 replies
I'm setting up a contact form where the user chooses the person to email from a dropdown list. I can't seem to get the dropdown value to pass properly, I'm sure I'm missing something and was wondering if anyone can help:

Here's the HTML:
Code:
<div class="form">What is your question related to: 
<select name="posSubject" id="posSubject">
<option value="bill" selected>General Question</option>
<option value="john">Warranty Question</option>
<option value="cory">Estimating</option>
<option value="bob">Service Question</option>
</select>
Here's the code in my mail script:
Code:
$yourEmail = $_POST["posSubject"] . '@mydomain.com';
It never picks up the posSubject value and the output is just @mydomain.com The select box is between the form tags, I'm using POST method, and the other fields are working fine. Any ideas?

Thanks!
#php #question #variable
  • Profile picture of the author BrianLeanza
    There's nothing really wrong with your code - as far as I can tell.
    I can only assume that you forgot to add the <form> tag ...
    {{ DiscussionBoard.errors[1697935].message }}
  • Profile picture of the author lisag
    If that's all the code you're running, you don't have a proper form. If there's more code, post it all and let us have a look.
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1698922].message }}
  • Profile picture of the author khtm
    In your mail script, try this:
    print_r($_POST);

    See what all your post variables are
    {{ DiscussionBoard.errors[1698953].message }}

Trending Topics