Form generating html code at top of web page

Issues related to forms.
Post Reply
GaryGem
Posts: 3
Joined: Tue Jan 12, 2021 4:57 pm

Form generating html code at top of web page

Post by GaryGem »

I've used the form function many times in the past, but getting html code at the top of my website page after I upload and the form does not send an email that it used to in the past.

Here is the html I am receiving:

"; throw new Exception($error); } $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)) . " : " . implode(",", $value) . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $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]['error'] == 0) { $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); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } ?>

Can some one please point me in the right direction to correct this issue.

Thanks in advance
GaryGem
Posts: 3
Joined: Tue Jan 12, 2021 4:57 pm

Re: Form generating html code at top of web page

Post by GaryGem »

Well I figured it out - need to change the page extension from html to php.
User avatar
Pablo
Site Admin
Posts: 3918
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Form generating html code at top of web page

Post by Pablo »

Correct.

Note that this is also mentioned in the FAQ:
https://www.quickandeasywebbuilder.com/ ... 10&t=32967
Post Reply