PHP/jQuery Contact Form Not Sending -


i have contact form validated using jquery.

the issues jquery solved in question.

however, can not form work when take out validation , have standalone php file html form , php send it.

there no error. page goes blank page after pressing submit , not message in code.

here code - have feeling simple!:

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php if (isset($_post['submit'])){ } else { ?>  <meta charset="utf-8" />  <link href='http://fonts.googleapis.com/css?family=pt+sans+narrow' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=droid+sans' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="**removed**/style.css">   <script type="text/javascript"> jquery.noconflict(); jquery(document).ready(function($) {   function isint(n) { return typeof n === 'number' && n % 1 == 0; }  // form validation $(".darkbtn").click(function(e) { e.preventdefault(); var email_check = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i; var email = $("form.form_contact .email").val();  var zipcheck = /[a-z]{1,2}[0-9r][0-9a-z]? [0-9][abd-hjlnp-uw-z]{2}/i; var zip = $("form.form_contact .zipcode").val();  var phonecheck = /^\d+$/; var phone = jquery("#contact_form .phone").val(); console.log(phone);  var error = "";  if(!email_check.test(email)) { error = "please give valid email address."  }  if(!zipcheck.test(zip)) { error = "please give valid postcode."; }  if(!phonecheck.test(phone) || phone.length != 11) { error = "please give valid phone number."; }   // no error ? -> submit if(error == "") { $(".form_error").hide(); $("form#contact_form").submit(); } else { $(".form_error").empty().text(error); $(".form_error").show(); } }); });   </script> </head> <body> <div class="menu_contact"> <h3>contact us</h3> <hr /> <form method="post" class="form_contact" id="contact_form"> <label>title:</label> <select class="input" name="title"> <option value="no">please select</option> <option value="mr">mr</option> <option value="mrs">mrs</option> <option value="miss">miss</option> <option value="ms">ms</option> </select> <label>contact number:</label> <input type="text" class="input phone" placeholder="your number" name="number"> <label>first name:</label> <input type="text" class="input" placeholder="john" name="fname"/> <label>surname:</label> <input type="text" class="input" placeholder="doe" name="sname"/> <label>email:</label> <input type="email" class="input email" placeholder="something@domain.com" name="email"/> <label>postcode:</label> <input type="text" class="input zipcode" placeholder="cw3 9ss" name="post"/> <label>date of birth:</label> <select class="input dateday" name="day"> <option>day</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> <select class="input datemonth" name="month"> <option>month</option> <option>january</option> <option>february</option> <option>march</option> <option>april</option> <option>may</option> <option>june</option> <option>july</option> <option>august</option> <option>september</option> <option>october</option> <option>november</option> <option>december</option> </select> <select class="input dateyear" name="year"> <option>year</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> </select> <label>where did hear us:</label> <select class="input" name="hear"> <option value="google">google</option> <option value="recommendation">recommendation</option> <option value="email">email</option> <option value="magazine">magazine</option> <option value="facebook">facebook</option> <option value="other">other</option> </select> <div class="form_error" style="display:none;color:red;text-align:center;text-shadow:none;"></div> <input class="darkbtn submit" type="submit" value="send message »" name="submit"> </form> </div> <?php } if (isset($_post['submit'])) {  $to = "**removed**"; $emailfrom = "**removed**"; $subject = "insurance quote"; $message="\r\n title:" . $title . "\r\n first name:" . $fname . "\r\n surname:" . $_post['sname'] . "\r\n number: " . $_post['number1'] . "\r\n email: " . $_post['email'] . "\r\n post: " . $_post['post'] . "\r\n day: " . $_post['day'] . "\r\n month: " . $_post['year'] . "\r\n hear: " . $_post['hear']; $headers = "from:" . $emailfrom;  if (mail($to,$subject,$message,$headers) ) { echo "thankyou using **removed**"; } }  ?> </body> </html> 

**update: when remove jquery validation page sends perfect.

however, if keep jquery validation in page not when press submit.**

change submit button's name 'submit' else , try.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -