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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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?

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.