Jump to content

PHP is displayed to page because Doctype = Strict


Recommended Posts

I am working on a Contact Form in my .php file. I have always worked with loose doctypes, however, today I am using strict. I have my php above my html, and none of the code runs. Instead, it just displays some of the Echos to the page (these aren't even called yet). Also, in my form, I have the following:

 

<INPUT NAME="Name" SIZE="30" value="<?php echo $Name; ?>">

 

On the page inside the field, it is displaying: <?php echo $Name; ?>

 

What is going on here and how can I fix this issue?

 

Yes, the pages are .php

Here is the doctype:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

Any input appreciated

Php is a server side scripting language. The doc type has nothing to do with php. Only the browser cares about the doc type.

 

If your php code is not being parsed and executed on the server it means that something is preventing the server from seeing the php code as php code.

 

You are either NOT using a .php extension on the file or you didn't browse to the file using a URL in your browser's address bar or you put the file into a location where the php language is disabled on your server...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.