Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help adding html line to php code

    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:

    PHP Code:
    // 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($arrSORT_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:

    Code:
    <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

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks!

    thanks so much! I knew I was missing something obvious. Think I need more coffee. Have a great day.
    D


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •