visitor Posted May 21, 2009 Share Posted May 21, 2009 Hi I have the following contact form script... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-ch" lang="de-ch"> <head> *{ padding:0; } fieldset{ width:455px; margin:8px auto; padding:8px; background: #ffffff; } .dropdown{ width:145px; } .contab{ width:455px; } .btngrp{ text-align:center; } #nachricht{ width:440px; } .norm{ border:1px solid #7f9db9; } .error{ border:1px solid red; } .droperror{ width:145px; border:1px solid red; } </style> <script type="text/javascript"> /* <![CDATA[ */ function trim(zeichenkette) { return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, ''); } function checkField(){ var field = document.getElementById("message"); field_input = field.value; if(field_input.length > 1000){ field.value = field_input.substr(0, 1000); alert("Entries limited to 1,000 characters!\nPlease trim your entry."); } } function hideErr(){ document.getElementById("errText").innerHTML = ""; } function checkInputs(){ var salutation = document.getElementById("salutation"); var company = document.getElementById("company"); var first_name = document.getElementById("first_name"); var name = document.getElementById("name"); var email = document.getElementById("email"); var phone = document.getElementById("phone"); var message = document.getElementById("message"); var salutation_val = salutation.selectedIndex; var company_val = trim(company.value); var first_name_val = trim(first_name.value); var name_val = trim(name.value); var email_val = trim(email.value); var phone_val = trim(phone.value); var message_val = message.value; if(salutation_val == 0){ salutation.className = "droperror"; }else{ if(salutation_val == 1){salutation_val = "Mr"} else{salutation_val = "Mrs"} salutation.className = "dropdown"; hideErr(); } if(company_val == ""){ company.className = "error"; }else{ company.className = "norm"; hideErr(); } if(first_name_val == ""){ first_name.className = "error"; }else{ first_name.className = "norm"; hideErr(); } if(name_val == ""){ name.className = "error"; }else{ name.className = "norm"; hideErr(vname); } if(email_val == "" | email_val.indexOf("@") == -1 | email_val.indexOf(".") == -1){ email.className = "error"; }else{ email.className = "norm"; hideErr(); } if(phone_val == ""){ phone.className = "error"; }else{ phone.className = "norm"; hideErr(); } if(message_val == ""){ message.className = "error"; }else{ message.className = "norm"; hideErr(); } if(salutation.className == "droperror" || company.className == "error" || first_name.className == "error" || name.className == "error" || email.className == "error" || phone.className == "error" || message.className == "error" ){ document.getElementById("errText").innerHTML="Please complete the fields marked in red" return false; } else{ ausgabe = "recipient: "+ hidden1_val + "\n" + "redirect : "+ hidden2_val + "\n" + "company: "+ company_val + "\n" + "salutation: "+ salutation_val + "\n" + "first_name: "+ first_name_val + "\n" + "name: "+ name_val + "\n" + "email: "+ email_val + "\n" + "phone: "+ phone_val + "\n" + "message: "+ message_val + "\n"; alert(ausgabe); } } function resetAll(){ document.getElementById("salutation").className="dropdown"; document.getElementById("company").className="norm"; document.getElementById("first_name").className="norm"; document.getElementById("name").className="norm"; document.getElementById("email").className="norm"; document.getElementById("phone").className="norm"; document.getElementById("message").className="norm"; } /* ]]> */ </script> </head> <body> <center> <!-- start contact form--> <FORM ACTION="econtact-evaluation.php" METHOD="post" enctype="multipart/form-data"> <div> <fieldset> <legend>Personal Information</legend> <table class="contab"> <tr> <td>Company*</td> <td><input class="norm" type="text" name="company" id="company" value=""/></td> <td> </td> <td> </td> </tr> <tr> <td>Salutation</td> <td><select name="salutation" id="salutation" class="dropdown"> <option>please select</option> <option>Mr</option> <option>Mrs</option> </select></td> <td> </td> <td> </td> </tr> <tr> <td>First Name*</td> <td><input class="norm" type="text" name="first_name" id="first_name" value=""/></td> <td>Name*</td> <td><input class="norm" type="text" name="name" id="name" value=""/></td> </tr> <tr> <td>E-mail*</td> <td><input class="norm" type="text" name="email" id="email" value=""/></td> <td> </td> <td> </td> </tr> <tr> <td>Street</td> <td><input class="norm" type="text" name="street" id="street" value=""/></td> <td>ZIP/City</td> <td><input class="norm" type="text" name="city" id="city" value=""/></td> </tr> <tr> <td>Phone*</td> <td><input class="norm" type="text" name="phone" id="telefon" value=""/></td> <td>Fax</td> <td><input class="norm" type="text" name="fax" id="fax" value=""/></td> </tr> </table> </fieldset> </div> <div class="btngrp"> <fieldset> <legend>Message Topic</legend> <input name="query" type="radio" value="mountainbike" checked="checked"/>Mountainbike <input name="query" type="radio" value="racebike"/>Racebike <input name="query" type="radio" value="motorbike"/>Motorbike </fieldset> </div> <div> <fieldset> <legend>Comment*</legend> <textarea id="message" name="message" rows="7" cols="4" onkeydown="checkField();"></textarea> </fieldset> </div> <div> <fieldset> <legend></legend> <input style="float:left;" type="submit" value="submit"/> <input style="float:right;" type="reset" value="reset" onclick="resetAll();"/> </fieldset> <span style="clear:both;"></span> </div> <div> <fieldset> <legend>Important</legend> Fields marked with an asterisk * are mandatory<br/> <span id="errText"></span> </fieldset> </div> </form> <br> </body> </html> and now the contact form evaluation script... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-ch" lang="de-ch"> <head> <?php error_reporting(E_ALL); ini_set("display_errors", true); $company = $first_name = $name = $email = $phone = $message = ""; $error = ""; if(isset($_POST['Name'])) { $errors = array(); if (empty($_POST['Company'])) $errors[] = "company"; else $company = stripslashes($_POST['Company']); if (empty($_POST['First Name'])) $errors[] = "first_name"; else $first_name = stripslashes($_POST['First Name']); if (empty($_POST['Name'])) $errors[] = "name"; else $name = stripslashes($_POST['Name']); if (empty($_POST['E-mail'])) $errors[] = "email"; else $email = stripslashes($_POST['E-mail']); if (empty($_POST['Phone'])) $errors[] = "phone"; else $phone = stripslashes($_POST['Phone']); if (empty($_POST['Message'])) $errors[] = "message"; else $message = stripslashes($_POST['Message']); if (count($errors)) $error = implode (", ", $errors) . " nicht eingegeben"; else { $strMailtext = ""; $strEmpfaenger = "xxxxx@gmx.de"; $strFrom = $name . " <" . $email . ">"; $strSubject = "Message from contact form"; $strReturnhtml = "thanks.htm"; $strDelimiter = ":\t"; $strMailtext .= "First Name: $first_name\n"; $strMailtext .= "Name: $name\n"; $strMailtext .= "Email: $email\n"; $strMailtext .= "Phone: $phone\n"; $strMailtext .= "Message: $message\n"; mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom) or ("Your message could not be delivered."); header("Location: thanks.htm"); exit; } } ?> </body> </html> somehow I only get a white paper page. No email message is received. Any idea,why? Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.