Jump to content

Where does the HTML and PHP go in a document?


ryanwood4

Recommended Posts

It might be a really stupid question.

 

I am trying to add a login page to my website. The page uses a .php extension, but I can't figure out where the PHP stuff should go in the page, and where the HTML stuff should go in the page.

 

So basically, I have the normal html page, but in the content area is the login form. I have tried some combinations like, the PHP at the top of the document and the HTML underneath with the form where I want it, but it just won't work.

 

Thanks.

For php to work you need to use the php extension, to use php on a page you also need to put it inside the php tag <?php code here ?>. Html code can be used anywhere around the outside of this tag.

 

As far as a login page goes you would have the form on your page for user and pass, when submitted will either goto another processing page or make it relaod the current page. If you wish to reload the current page the put the php form processing at the top of the page in php brackets and use a if statement to check if the submit button has been clicked.

 

eg.. login.php

 

<?php if (isset($_POST['submit'])) {

    process form here

}

?>

<html>

<form action="<?php $_SERVER['PHP_SELF']?>" method="post">

inputs feilds here

</form>

</html>

for the css you can save your css as filename.css and link using this code

 

<link href="filename.css" rel="stylesheet" type="text/css" />

 

that of course has to be placed in your head then you can place your divs in the php document

 

i guess your trying to make the images show

are you doing "<img src='src'>" inside php or regular html?

when your looking at your page in the browser, right click on the images that are not showing and look at the properties, you need to check to make sure you file locations are set correctly and the images are actually on the server or they will not show

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.