PRASANTH
PRASANTH

Reputation: 705

load whole html script in php file

Advance apologies for this noob question but i have to do it perfectly. I have made a website which are all html files and all are working fine. Now for the session handing i have to convert all the html files into php like

<!DOCTYPE HTML>
<html>
<head>
    <link type="text/css" rel="stylesheet" href="css/bootstrap-min.css"/>
</head>
<body>
  Body elements
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

to something like

<?php
  "SESSION HANDLING PHP CODING"


  echo '<!DOCTYPE HTML>
    <html>
    <head>
        <link type="text/css" rel="stylesheet" href="css/bootstrap-min.css"/>
    </head>
    <body>
      Body elements
    </body>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    </body>
    </html>'
?>

Hoping for best possible solution. Thanks

Upvotes: 0

Views: 1195

Answers (3)

swapnesh
swapnesh

Reputation: 26732

You actually need to refer session handling in PHP.

And then separate the logical php part from the HTML part as mentioned in other answers.

Upvotes: 0

Ilmo Euro
Ilmo Euro

Reputation: 5165

You really don't have to do that - you can mix HTML and PHP easily. Just surround the code with <?php and ?> tags:

<?php /* handle session here */ ?>
<!DOCTYPE HTML>
<html>
<head>
    <link type="text/css" rel="stylesheet" href="css/bootstrap-min.css"/>
</head>
<body>
  Body elements
  <?php echo $something_you_handled_earlier; ?>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

Upvotes: 1

Lucian Depold
Lucian Depold

Reputation: 2017

You don't need to do an echo, just close the php tag with "?>":

<?php
//CODE
?>

Your Html Stuff

Upvotes: 1

Related Questions