Jump to content

how can you have php on an HTML page?


abcdabcd

Recommended Posts

<html>
//all of your HTML stuff goes here

//anywhere you want a php statement use these
<?php you would put whatever PHP you want inside of these, it can go anywhere in your html   ?> 

 

you will have to change the extension of your page to .php though, or they will not be noticed as PHP by the browser.

Link to comment
Share on other sites

like a footer?

 

// html code

 

 

<div id='footer'>

// define properties, place at bottom, etc..

 

<?php

 

// code here, displayed at bottom

 

?>

</div>

 

I think you may need to do some more reading you don't know how to place php at the bottom of a page. Sorry if that came off as rude.

Link to comment
Share on other sites

If changing to pages with PHP extensions is not an option, you can tell Apache (Assuming you're a winner and you're not using something horrible like IIS) to parse PHP in html pages. You'll need to make that change server side so you'll need root access.

Link to comment
Share on other sites

Thanks for all the replies, what if the php is above the html content?  Do I use the same method:

 

<html>

//all of your HTML stuff goes here

 

//anywhere you want a php statement use these

<?php you would put whatever PHP you want inside of these, it can go anywhere in your html  ?>

Link to comment
Share on other sites

Yup. Your <?php blah blah blah ?> can go anywhere on the page.  It sounds like you are about at the same stage as I am with php so keep things simple and call all your pages with php in them '.php' rather than anything else. The other comments are just showing off!!!

Link to comment
Share on other sites

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.