php variable question

by coog
1 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:
PHP 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:
PHP 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 JaguarJaguar
    Based on your given code, I assume you haven't used the Form tag. Try this and I hope it will definitely work.
    <?php
    if (isset($_REQUEST['CSubmit']))
    {
    $curr = $_POST ['posSubject']. '@mydomain.com';
    echo $curr;
    }
    ?>


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Test Site</title>
    </head>
    <body>
    <div class="form">What is your question related to:
    <form action="" method="post" name = "myForm" id="myForm">
    <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>
    <input name="CSubmit" type="submit" class="submit" id="CSubmit" value="Submit" />
    </form>
    </div>
    </body>

    {{ DiscussionBoard.errors[1696804].message }}

Trending Topics