...

View Full Version : help adding html line to php code



deniseb
06-30-2007, 04:11 PM
ok.. I hope this is the right place for this request.
I have the following code someone wrote for me that loads images to a page and display a textarea under the image that contains the link to the image:



// Display image list
$arr = array();

if ($handle2 = opendir($root2folder . 'images/')) {
$cnt = 0;
while (false !== ($file = readdir($handle2))) {
if ($file != "." && $file != ".." && $file !="Thumbs.db") {
if(($cnt>=$imageListStart)&&($cnt<$imageListStop)){
array_push($arr, $file);
}
$cnt++;
}
}
closedir($handle2);
}

sort($arr, SORT_STRING);

$i = 1;
foreach($arr as $val) {
echo '<div class="showImages">' . "\n" .
'<img src="' . $pb2folder . 'images/' . $val .'" alt="' . $val . '" />' . "\n" .
'<form action=""><input type="text" name="showImage' . $i . '" class="showImageTextBox" onfocus="this.form.showImage' . $i . '.select()" onclick="this.form.showImage' . $i . '.select()" value="&lt;a href=&quot;' . $urlBase . '&quot;&gt;&lt;img src=&quot;' . $pb2folder . 'images/' . $val . '&quot; alt=&quot;' . $imgAlt . '&quot; border=&quot;0&quot;&gt;&lt;/a&gt;' . $linkBack . '" onmouseover="this.style.borderColor=\'#' . $randomColors[$random10[0]] . '\'" onmouseout="this.style.borderColor=\'#555555\'" /></form>' . "\n" .

(want to add send to a friend code here)

'</div>' . "\n\n";
$i++;
}



I want to add this line of html code where I note above:



<a target="_blank" href="http://website.com/recform.php">Share with a Friend</a><br />


how would I do that? no matter what I try I get some error or another.
Thanks!
Denise

rafiki
06-30-2007, 04:48 PM
close the php tags and add ur line in. ?> <a target="_blank" href="http://website.com/recform.php">Share with a Friend</a><br /> <?php
you can have it in an if or a loop or whatever you need :)

deniseb
06-30-2007, 05:18 PM
thanks so much! I knew I was missing something obvious. Think I need more coffee. :) Have a great day.
D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum