HTML code appears in Browser Preview

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
petrorod@aol.com
 
 
Posts: 2
Joined: Thu Jun 07, 2018 6:34 pm

HTML code appears in Browser Preview

Post by petrorod@aol.com » Thu Jul 12, 2018 1:56 pm

I built a simple website and was working fine. I then added a few layergrids in the Index page and now when I compile and preview in browser using Chrome the first several lines show HTML code..... and then the rest of the website site...... see HTML code below......

"; } 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); } $search = array("ä", "Ä", "ö", "Ö", "ü", "Ü", "ß", "!", "§", "$", "%", "&", "/", "\x00", "^", "°", "\x1a", "-", "\"", " ", "\\", "\0", "\x0B", "\t", "\n", "\r", "(", ")", "=", "?", "`", "*", "'", ":", ";", ">", "<", "{", "}", "[", "]", "~", "²", "³", "~", "µ", "@", "|", "<", "+", "#", ".", "´", "+", ","); $replace = array("ae", "Ae", "oe", "Oe", "ue", "Ue", "ss"); foreach($_POST as $name=>$value) { $name = str_replace($search, $replace, $name); $name = strtoupper($name); $form_data[$name] = $value; } $db = mysqli_connect($mysql_server, $mysql_username, $mysql_password) or die('Failed to connect to database server!
'.mysqli_error($db)); mysqli_query($db, "CREATE DATABASE IF NOT EXISTS $mysql_database"); mysqli_select_db($db, $mysql_database) or die('Failed to select database
'.mysqli_error($db)); mysqli_query($db, "CREATE TABLE IF NOT EXISTS $mysql_table (ID int(9) NOT NULL auto_increment, `DATESTAMP` DATE, `TIME` VARCHAR(8), `IP` VARCHAR(15), `BROWSER` TINYTEXT, PRIMARY KEY (id))"); foreach($form_data as $name=>$value) { mysqli_query($db ,"ALTER TABLE $mysql_table ADD $name VARCHAR(255)"); } mysqli_query($db, "INSERT INTO $mysql_table (`DATESTAMP`, `TIME`, `IP`, `BROWSER`) VALUES ('".date("Y-m-d")."', '".date("G:i:s")."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."')")or die('Failed to insert data into table!
'.mysqli_error($db)); $id = mysqli_insert_id($db); foreach($form_data as $name=>$value) { mysqli_query($db, "UPDATE $mysql_table SET $name='".mysqli_real_escape_string($db, $value)."' WHERE ID=$id") or die('Failed to update table!
'.mysqli_error($db)); } mysqli_close($db); header('Location: '.$success_url); exit; } ?>

what am I doing wrong???

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

Re: HTML code appears in Browser Preview

Post by Pablo » Thu Jul 12, 2018 2:12 pm

Please see 'PHP code is showing on the page. What is happening?' in the FAQ:
viewtopic.php?f=10&t=32967

petrorod@aol.com
 
 
Posts: 2
Joined: Thu Jun 07, 2018 6:34 pm

Re: HTML code appears in Browser Preview

Post by petrorod@aol.com » Fri Jul 13, 2018 3:45 pm

The Property page extension type is set to "HTML" and not PHP.... any other ideas why yhis code is appearing at the top of the website when previewed in the chrome browser and when I publish the site.....

User avatar
BaconFries
 
 
Posts: 3883
Joined: Thu Aug 16, 2007 7:32 pm

Re: HTML code appears in Browser Preview

Post by BaconFries » Fri Jul 13, 2018 4:05 pm

any other ideas why yhis code is appearing at the top of the website when previewed in the chrome browser
The page extension must be set to php not html. PHP is a server sided language which is processed by the server and not the browser, so for it to display correctly the page extension must be .php for the server to read and display correctly.

Please also note you cannot Preview PHP locally in any browser including Chrome it must be published to your host/server that supports php to be correctly processed.

You can also use the following 'Remove PHP during preview' in Tools->Options->Preview. so you can see what the page looks like. But to see it fully work you need to publish as mentioned.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests