After adding php to my form it shows a error on the page.

As the subject says: After adding php to my form it shows a error on the page, After testing the form everything works fine but i cant find and get rid of this error text in the corner.

the code im using for the form and the PHP is:

[php]



Title:




Mr
Mrs
Miss
Ms
Dr



Name:






Phone:






Email:






Make:






Operating System:




Windows 8
Windows 7
Windows Vista
Windows XP
Other
Linux
Mac
Android



Comments:






<?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 = "[email protected]"; $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
"; } 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 ''; } } else{ echo "error";} ?>[/php]

Thanks in advance

First I just have to write “CSS inline-styling” :o

OK, I feel better… ;D

It looks like you taking an old script and trying to convert to send via email?

I don’t know where you have your PHP located, be it on the same page or a different page?

If it’s on the same page the php should be on top.

However, both of them have to have action="" in the HTML element :

<form action="" name="Contact" method="post" enctype="multipart/form-data" id="Form1">

it looks like this form had something to do with image file, yet you’re not sending any images. So I would assume it would be OK to get rid of enctype=“mutipart/form-data”? I’m no expert the more I look at this form the more I think it might had been written for a different language like Ruby on Rails or Microsoft’s asp.net? Someone more familiar probably would be able to tell. However, fix that to go from there and then the other errors can be addressed.

The OP used WYSIWYG Web Builder
http://www.wysiwygwebbuilder.com

I have not tried it, but if thats the code it gives you, I will pass.

Sponsor our Newsletter | Privacy Policy | Terms of Service