*** SOLVED *** HTML coding at head of webpages

Issues related to previewing and publishing your web site.
Post Reply
SKW
 
 
Posts: 31
Joined: Wed Feb 03, 2010 4:42 am

*** SOLVED *** HTML coding at head of webpages

Post by SKW » Tue Dec 01, 2015 1:48 am

Hello,

I've just published a pretty basic, three page, website which works perfectly in "Preview in Browser" (using any of Internet Explorer; Firegox; Chrome; Opera). The pages and attributes all work fine on the published site, also.

Problem is that on each of the published pages, there are eight lines of HTML code at the head of each page. The code remains constant, whichever page is navigated to. This is regardless of the Browser used and I have also tried (with the same failed result) on four separate PCs.

The code is as follows:

"; } 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", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response"); $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]['error'] == 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); } header('Location: '.$success_url); exit; } ?>

Please could someone offer any advice?

Thanks in advance.

pajadt
 
 
Posts: 369
Joined: Sat Mar 16, 2013 11:23 am
Location: Europe
Contact:

Re: HTML coding at head of webpages

Post by pajadt » Tue Dec 01, 2015 2:24 am

Hi SKW
i think you have at page contact form, pages where is contact form must be php not Html. Please carefully read this:
viewtopic.php?f=10&t=32967

User avatar
Pablo
 
Posts: 18673
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: HTML coding at head of webpages

Post by Pablo » Tue Dec 01, 2015 8:03 am

This is the PHP code of the form processor.
You will need to publish the pages for the forms to work.

Related FAQ:
viewtopic.php?f=10&t=36493

SKW
 
 
Posts: 31
Joined: Wed Feb 03, 2010 4:42 am

Re: HTML coding at head of webpages

Post by SKW » Tue Dec 01, 2015 12:21 pm

Thanks Chaps,

Solved it in one, for me.

Very relieved and thankful for your help.

So, if a form is used, it must be php but to preview, it must be html. Which means that form pages should only have the html changed to php just immediately prior to publishing?

Must make a mental note of that.

Thanks again. :D

User avatar
Pablo
 
Posts: 18673
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: HTML coding at head of webpages

Post by Pablo » Tue Dec 01, 2015 12:24 pm

You can preview the current page, even if it has PHP by enabling 'Remove PHP code during preview' in Tools->Options->Publish & Preview

Post Reply