Hey, I need a little bit of help with some code i'm writing. Let me explain what i'm trying to do first of all.
I am trying to create a script which will generate repetitive html code for me and save it to a text file. I have thumbnails on my site which link to the larger version of the image. Both images have the same filenames. Each image has this same exact html code, with the exception of the image name. All the images will need to be in the correct locations in order for this to work, as well have names like 1.jpg 2.jpg 3.jpg etc...
<p align="center"><a href="../Picture-Video/Snowmaking_Sue15B/04011010.JPG">
<img border="0" src="Picture%20Thumbnails/Snowmaking/04011010.JPG" width="160" height="120"></a><a href="../Picture-Video/Snowmaking_Sue15B/04011009.JPG"><img border="0" src="Picture%20Thumbnails/Snowmaking/04011009.JPG" hspace="10" width="160" height="120"></a><a href="../Picture-Video/Snowmaking_Sue15B/04011013.JPG"><img border="0" src="Picture%20Thumbnails/Snowmaking/04011013.JPG" width="160" height="120"></a></p>
My create.php page creates the file, and writes to the file x number of times (as inputed by the user). Here is my php code:
<?php
$s = $POST['start'];
$e = $POST['end'];
$data = "Problem is here!!";
$file = $_POST['filename'];
for ($s=1; $s<=$e; $s++)
{
if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, $data)) { echo "Cannot write to file"; }
fclose($file_handle);
}
?>
The problem here is the $data variable. I get a parse error (invalid string) when i enter in the html coding that i'm trying to replicate. Can you guys think of any way to get around this? Do you understand what i'm trying to do?
Thank you so much! 😃
Jason