PHP coding?

Hi Friends,

How do you use div class’ in php such that you can attach html generated by php into that div class. Example

<html>
<head>
</head>
<body>
<div class=“border”>
</div>

<?php

echo “This needs to go into the class border”

?>

</body>
</html>


[b]Diamond Engagement Rings[/b]
[b]Loose Diamonds[/b]
[b]Wedding Rings - DreamStone[/b]

You’d have to use AJAX with PHP I think, kind of like…


/* JQuery Code */
$(document).ready(function{
  $(".border").load('url/file.php');
});

PHP is executed on the server, and the resulting HTML page is sent to your browser. So if you want to add something to a page with PHP, all you have to do is rename the page from .html to .php, and add the PHP code where you want the result to appear:

index.php


<html>
<head>
</head>
<body>
<div class="border">
<?php

echo "This needs to go into the class border"

?>
</div>
</body>
</html>

all you have to do is rename the page from .html to .php

You can tell the server to parse any file as php.

Are you really trying to achieve this with PHP? It would be good and easy with JS (jQuery). I would do something like this at the end of the page if the generated string is not much longer:


/* JQuery Code */
$(document).ready(function{
    $(".border").html('This needs to go into the class border');
});