Code showing on Contact Us Page

Issues related to forms.
Post Reply
mnew
 
 
Posts: 2
Joined: Fri Sep 22, 2017 12:11 am

Code showing on Contact Us Page

Post by mnew » Fri Sep 22, 2017 1:07 am

PHP code is showing on the top of my Contact Us page at https://changingyourlifecoaching.com/Contact_Us.html which is html. My actual form is located at https://changingyourlifecoaching.com/Co ... s_Form.php because I couldn’t figure out how to get it to display properly on my Contact Us Page. I checked all of the following:

PHP code is showing on the page. What is happening?
1. Is the page extension set to PHP (in Page Properties)?
2. Are you viewing the page in local preview? PHP does not work in preview. The page must be published to a webserver.
3. Does your website support PHP? Is it enabled? Contact your webhost for more details.
4. Did you insert any code at the start of the page yourself? If yes, please remove it.

In addition, I have a Feedback_Form.html which is my Success Page and an Error_for_Form.html Page. Both of these pages are children pages to the Contact_Us_Form.html.

The following code is located at the top of my https://changingyourlifecoaching.com/Contact_Us.html:

"; } 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; $logdata = ''; 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) { $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 let me know what I am doing wrong.

Thanks.

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

Re: Code showing on Contact Us Page

Post by Pablo » Fri Sep 22, 2017 6:06 am

The following code is located at the top of my https://changingyourlifecoaching.com/Contact_Us.html:
This is because the page extension is not set to PHP!
It should be:
https://changingyourlifecoaching.com/Contact_Us.php

mnew
 
 
Posts: 2
Joined: Fri Sep 22, 2017 12:11 am

Re: Code showing on Contact Us Page

Post by mnew » Fri Sep 22, 2017 2:59 pm

Thank you! It worked.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests