thetechcenter Posted January 5, 2015 Share Posted January 5, 2015 (edited) I can not seem to find why i have a error text in the corner of my form, it is not there if i delete the php code but then the form dont work....the form works fine but i dont want to see the error text on my web page, please helpfor reference to view what i am talking about please go to www.tectechcenter.ca/contact.phpmy code: <?php if(isset($_POST['sub'])){ function ValidateEmail($email) { $pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i'; return preg_match($pattern, $email); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $mailto = "info@thetechcenter.ca"; $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = "Support Query"; $message = "Values submitted from web site form:"; $success_url = "index.html"; $error_url = ""; $error = ''; $eol = "\r\n"; $max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000; $boundary = md5(uniqid(time())); $header = "From: ".$mailfrom.$eol; $header .= "Reply-To: ".$mailfrom.$eol; $header .= "MIME-Version: 1.0".$eol; $header .= "Content-Type: multipart/mixed; boundary=".$boundary.$eol; $header .= "X-Mailer: PHP v".phpversion().$eol; if (!ValidateEmail($mailfrom)) { $error .= "The specified email address is invalid!\n<br>"; } if (!empty($error)) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $error, $errorcode); echo $errorcode; exit; } $internalfields = array ("submit", "reset", "send", "captcha_code"); $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['ror'] == 0 && $_FILES[$key]['size'] <= $max_filesize) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.html">'; } } else{ echo "error";} ?> Form code: <form name="Contact" method="post" enctype="multipart/form-data" id="Form1"> <div id="wb_Text4" style="position:absolute;left:10px;top:15px;width:119px;height:20px;text-align:left;z-index:0;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Title:</div> </div> </div> <select name="country" size="1" id="Combobox1" style="position:absolute;left:134px;top:15px;width:198px;height:23px;z-index:1;"> <option selected="" value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Miss">Miss</option> <option value="Ms">Ms</option> <option value="Dr">Dr</option> </select> <div id="wb_Text5" style="position:absolute;left:10px;top:45px;width:119px;height:20px;text-align:left;z-index:2;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Name:</div> </div> </div> <input type="text" id="Editbox1" style="position:absolute;left:134px;top:45px;width:198px;height:23px;line-height:23px;z-index:3;" name="name" value=""> <div id="wb_Text7" style="position:absolute;left:10px;top:75px;width:119px;height:20px;text-align:left;z-index:4;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Phone:</div> </div> </div> <input type="text" id="Editbox2" style="position:absolute;left:134px;top:75px;width:198px;height:23px;line-height:23px;z-index:5;" name="phone" value=""> <div id="wb_Text8" style="position:absolute;left:10px;top:105px;width:119px;height:20px;text-align:left;z-index:6;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Email:</div> </div> </div> <input type="text" id="Editbox3" style="position:absolute;left:134px;top:105px;width:198px;height:23px;line-height:23px;z-index:7;" name="email" value=""> <div id="wb_Text9" style="position:absolute;left:10px;top:135px;width:119px;height:20px;text-align:left;z-index:8;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Make:</div> </div> </div> <input type="text" id="Editbox4" style="position:absolute;left:134px;top:135px;width:198px;height:23px;line-height:23px;z-index:9;" name="make" value=""> <div id="wb_Text10" style="position:absolute;left:10px;top:165px;width:119px;height:20px;text-align:left;z-index:10;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Operating System:</div> </div> </div> <select name="os" size="1" id="Combobox2" style="position:absolute;left:134px;top:165px;width:198px;height:23px;z-index:11;"> <option value="Windows 8">Windows 8</option> <option selected="" value="Windows 7">Windows 7</option> <option value="Windows Vista">Windows Vista</option> <option value="Windows XP">Windows XP</option> <option value="Windows Other">Other</option> <option value="Linux">Linux</option> <option value="Mac OSX">Mac</option> <option value="Android">Android</option> </select> <div id="wb_Text11" style="position:absolute;left:10px;top:195px;width:119px;height:20px;text-align:left;z-index:12;border:0px #c0c0c0 solid;overflow-y:hidden;background-color:transparent;"> <div style="font-family:arial;font-size:13px;color:#000000;"> <div style="text-align:left">Comments:</div> </div> </div> <textarea name="message" id="TextArea1" style="position:absolute;left:134px;top:195px;width:198px;height:98px;z-index:13;" rows="1" cols="1"></textarea> <input type="submit" id="Button1" name="sub" value="Send" style="position:absolute;left:134px;top:300px;width:96px;height:25px;z-index:14;"> <input type="reset" id="Button2" name="" value="Reset" style="position:absolute;left:134px;top:330px;width:96px;height:25px;z-index:15;"> </form> Edited January 5, 2015 by thetechcenter Quote Link to comment https://forums.phpfreaks.com/topic/293696-error-text-in-the-corner-of-my-form-but-from-works/ Share on other sites More sharing options...
ginerjm Posted January 5, 2015 Share Posted January 5, 2015 Error text? Is this an error message from your script or is it perhaps an error message from PHP? Show us the message. Quote Link to comment https://forums.phpfreaks.com/topic/293696-error-text-in-the-corner-of-my-form-but-from-works/#findComment-1501853 Share on other sites More sharing options...
thetechcenter Posted January 5, 2015 Author Share Posted January 5, 2015 Error text? Is this an error message from your script or is it perhaps an error message from PHP? Show us the message. there is no actual error message just a simple black text that says error appearing on the page..... Quote Link to comment https://forums.phpfreaks.com/topic/293696-error-text-in-the-corner-of-my-form-but-from-works/#findComment-1501862 Share on other sites More sharing options...
Solution laflair13 Posted January 5, 2015 Solution Share Posted January 5, 2015 I am new to this, but if the form goes through, then I suggest getting rid of the "echo" on the bottom of your script. else{ echo "error";} Quote Link to comment https://forums.phpfreaks.com/topic/293696-error-text-in-the-corner-of-my-form-but-from-works/#findComment-1501863 Share on other sites More sharing options...
thetechcenter Posted January 5, 2015 Author Share Posted January 5, 2015 I am new to this, but if the form goes through, then I suggest getting rid of the "echo" on the bottom of your script. else{ echo "error";} Wow something so simple.. that and moveing my Php to the top of the page solved it....Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/293696-error-text-in-the-corner-of-my-form-but-from-works/#findComment-1501864 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.