how do you do that ??

Discussion in 'PHP' started by q8uwait, Nov 15, 2007.

  1. #1
    hello, I have this line in my upload script code

            #If link is to be shown, show link
    
            if ($see_url)
    
            {
    
          	  $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";
    
            }
    PHP:
    This part of teh code shows the link of the file uploaded.

    I would like to add below it the following forms with the links in it but they are in html ,, when i place them i get an error in php , how do i place the following code correctly in the php file. I would like to add it below the above code, like under the link showed.

    <form name="uteam_uploader">
    <p align="center">[<span lang="en-us">Click once to copy</span><br>
    <input name="linkcode" onclick="Click2Copy('uteam_uploader.linkcode')" value="&quot; . $url_path . &quot;/uploads27/&quot; . $newfilename . &quot;" size="20">
    </p>
    <p align="center">[<span lang="en-us">Forums use</span><br>
    <input name="forumcode" onclick="Click2Copy('uteam_uploader.forumcode')" type="text" value="[img]&quot; . $url_path . &quot;/uploads27/&quot; . $newfilename . &quot;[/img]" size="20"></form>
    Code (markup):

    Thanks for any help
     
    q8uwait, Nov 15, 2007 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    put ?> after the ending braces of if } and paste html code after that and in html to show php variable values use these tags <?= ?> like
    <input name="linkcode" onclick="Click2Copy('uteam_uploader.linkcode')" value="&quot; . <?= $url_path ?>. &quot;/uploads27/&quot; . <?= $newfilename ?> . &quot;" size="20">

    or simple echo or print variable <? echo $newfilename; ?>
     
    greatlogix, Nov 15, 2007 IP
  3. q8uwait

    q8uwait Peon

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hello,

    that works but then the form shows on the top of the page, and has all links correctly ,,

    but i want to show it under the link in the php code shown above..
     
    q8uwait, Nov 15, 2007 IP
  4. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #4
    what i have understand is that you want to show HTML after this line
    $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";

    right?

    if yes than put ?> after above line and place all html after this tag. Than start php tag <? and close if statement with } ?>
     
    greatlogix, Nov 15, 2007 IP
  5. q8uwait

    q8uwait Peon

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    mm not exactly,,

    you see in this line

    what i have understand is that you want to show HTML after this line
    $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";

    it shows a link correct,

    i would like to put the html after here

    $newfilename . "</a><br><br>

    I tried what you said, but then the form went at the top,,
     
    q8uwait, Nov 15, 2007 IP
  6. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #6
    <?
    //...........code
    #If link is to be shown, show link
    
            if ($see_url)
    
            {
    
              $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";
    ?>
    <form name="uteam_uploader">
    <p align="center">[<span lang="en-us">Click once to copy</span><br>
    <input name="linkcode" onclick="Click2Copy('uteam_uploader.linkcode')" value="&quot; . $url_path . &quot;/uploads27/&quot; . $newfilename . &quot;" size="20">
    </p>
    <p align="center">[<span lang="en-us">Forums use</span><br>
    <input name="forumcode" onclick="Click2Copy('uteam_uploader.forumcode')" type="text" value="[img]&quot; . $url_path . &quot;/uploads27/&quot; . $newfilename . &quot;[/img]" size="20"></form>
    <?
            }
    		// ............more code
    ?>		
    PHP:
    Did you try above code and it did not work. please confirm.

    I did not see that you are printing line in your if statement.

      $uploaderinfo .=.....
    PHP:
    where you echo or print $uploaderinfo? it should be before <form... tag
     
    greatlogix, Nov 15, 2007 IP
  7. q8uwait

    q8uwait Peon

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    hello this is what i have

            #If link is to be shown, show link
    
            if ($see_url)
    
            {
    
          	  $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";
    ?>
    <form name="uteam_uploader">
    <p align="center">[<span lang="en-us">Click once to copy</span><br>
    <input name="linkcode" onclick="Click2Copy('uteam_uploader.linkcode')" value="<?= $url_path ?>./uploads27/<?= $newfilename ?> " size="20">
    </p>
    <p align="center">[<span lang="en-us">Forums use</span><br>
    <input name="forumcode" onclick="Click2Copy('uteam_uploader.forumcode')" type="text" value="[img]<?= $url_path ?>/uploads27/<?= $newfilename ?>[/img]" size="20"></form>
    <?
            }
    
            #If entries are to be logged, log them
    PHP:
    but the form appears on the top after i upload a file.
     

    Attached Files:

    q8uwait, Nov 15, 2007 IP
  8. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #8
    where is echo $uploaderinfo; or print( $uploaderinfo); statement. You must do it in if condition.
    
    if ($see_url)
    
            {
    
              $uploaderinfo .= $f_link . "<br><a href=\"" . $url_path . "/uploads27/" . $newfilename . "\" target=\"_blank\">" . $url_path . "/uploads27/" . $newfilename . "</a><br><br>\n";
           echo $uploaderinfo; // print link here 
    ?>
    html code here
    
    PHP:
     
    greatlogix, Nov 15, 2007 IP