Hello. Thanks for being out here to help PHP newbies like me.
I need some advice.
I want my script to write into an HTML file using the "fwrite" function. The problem I have is that the script writes to the HTML file but at the end of the file, outside the appropriate tags.
What I want to do is to make the script with a string (just text) to a specific tag inside the body tag in HTML.
Here is what I have so far.
CODE
<?php
$my_file = "some_file.php";
$fh = fopen($my_file, 'a') or die("can't open file");
$string_data = "Lorem ipsum";
fwrite($fh, $string_data);
echo "File succesfully written";
?>
This code works even though is simple and given my lack of experience, but this is the result i get:
CODE
<html >
<head>
</head>
<body>
<div id="my_div">
<!-- Content goes here-->
</div>
</body>
</html>
[b]Lorem ipsum[/b]
Again, how can I specify to what div the script writes the string?
Thanks a lot in advance for any advice that I can get in this matter.
Juan Carlos
This post has been edited by no2pencil: 5 Mar, 2008 - 07:50 PM