Member Avatar for LuxNova_1

Hello! I'm crazy new at PHP and I'm having problems with recieving all the info from the drop down portion of my form in the email submitted from php. The code for the HTML portion is:

    <label for="birthday">Birthday</label>
        <select name="Month" value="option">
            <option value="January">January</option>
            <option value="February">February</option>
        </select>
        <select name="Day" value="option">
            <option value="01">01</option>
            <option value="02">02</option>
        </select>
        <select name="Year" value="option">
            <option value="2012">2012</option>
            <option value="2011">2011</option> 
        </select>

PHP portion:

    $month = $_POST['month']; // not required
    $day = $_POST['day']; // not required
    $year = $_POST['year']; // not required 



$email_message .= "Month: ".clean_string($month)."\n";
$email_message .= "Day: ".clean_string($day)."\n";
$email_message .= "Year: ".clean_string($year)."\n";

All the rest of the info from the form arrives perfectly, and the "month", "day", and "year" fields in the email show:

 Month:
 Day:
 Year:

How do I fix this so it sends the selected value? Any help is much apprecated, thank you so much for reading.

Recommended Answers

All 3 Replies

Member Avatar for Zagga

Hi LuxNova_1,

Check your capitalisation. Your select field has a name of 'Month' but you are later trying to retrieve $_POST['month']

Member Avatar for LuxNova_1

Ah! Twarted by the obvious. Thank you Zagga. Works perfectly, you have made a happy camper.

Member Avatar for Zagga

Glad I could help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.