Send DropDown Field from HTML page via PHP to Email

385 views Asked by At

I get "Name", "Email", "Phone" sent to email just fine, but my dropdown fields (reason,product,salesperson) do not come through my email. Can you help?

My HTML Page has this code:

**<form id="contact-form">
                        <div class="success-message">Contact form submitted.</div>
                        <div class="holder">
                            <div class="form-div-1 clearfix">
                                <label class="name">
                                    <input type="text" placeholder="Name*:" data-constraints="@Required @JustLetters" />
                                    <span class="empty-message">*This field is required.</span>
                                    <span class="error-message">*This is not a valid name.</span>
                                </label>
                            </div>
                            <div class="form-div-2 clearfix">
                                <label class="email">
                                    <input type="text" placeholder="Email*:" data-constraints="@Required @Email" />
                                    <span class="empty-message">*This field is required.</span>
                                    <span class="error-message">*This is not a valid email.</span>
                                </label>
                            </div>
                            <div class="form-div-3 clearfix">
                                <label class="phone notRequired">
                                    <input type="text" placeholder="Phone:" data-constraints="@JustNumbers"/>
                                    <span class="empty-message">*This field is required.</span>
                                    <span class="error-message">*This is not a valid phone.</span>
                                </label>
                            </div>
                        </div>

                        Reason:  <select id="reason">
<option value="General">General Question</option>
<option value="MOPoster Quote">Price Quote</option>
<option value="Feedback">Feedback</option>
</select>
  Product:  <select id="product">
<option value="None">None</option>
<option value="Banners">Banners</option>
<option value="Signs">Signs</option>
<option value="Posters">Posters</option>
<option value="Decals">Decals</option>
<option value="Magnetics">Magnetics</option>
<option value="Billboards">Billboards</option>
<option value="Tradeshow">Tradeshow Displays/Materials</option>
<option value="Vehicle Graphics/Wraps">Vehicle Graphics/Wraps</option>
</select>
Salesperson:  <select name="salesperson">
<option value="None">I don't have one</option>
<option value="Tabitha">Tabitha Barham</option>
<option value="Audrey">Audrey Pyles</option>
</select><br>
                        <div class="form-div-4 clearfix">
                            <label class="message">
                                <textarea placeholder="If you are inquiring about a quote please include as many details as possible such as: size, material, single or double sided, 1-color or full-color, etc." data-constraints='@Required @Length(min=20,max=999999)'></textarea>
                                <span class="empty-message">*This field is required.</span>
                                <span class="error-message">*The message is too short.</span>
                            </label>
                        </div>
                        <div class="btns">
                            <a href="#" data-type="submit" class="btn-default btn4">submit comment</a>
                        </div>  
                    </form>**

MY PHP Page has this code to send the email:

function formSubmit(){
                $('[data-constraints]',form).trigger('validate.form')

                if(!$('label.'+opt.invalidClass+',label.'+opt.emptyClass,form).length){                 
                    $.ajax({
                        type:"POST"
                        ,url:opt.mailHandlerURL
                        ,data:{
                            name:getValue($('label.name input'))
                            ,email:getValue($('label.email input'))
                            ,phone:getValue($('label.phone input'))
                            ,reason:getValue($('label.reason input'))
                            ,product:getValue($('label.product input'))
                            ,salesperson:getValue($('label.salesperson input'))

...This code continues but this is all you should need to help me I hope!

I get "Name", "Email", "Phone" sent to email just fine, but my dropdown fields (reason,product,salesperson) do not come through my email. Can you help?

1

There are 1 answers

1
AudioBubble On

you don't show getValue

but for jquery you should use.

$( "select.reason option:selected").val();