0

I have a text file called database.txt and it contains 3 URLs separated with a " - ".

<?
$dir = $_POST['path123'];
$percorso = file($dir."/database.txt");
while(list(,$value) = each($percorso)){
list($gp1, $gp2, $gp3) = split("[:]", $value);
#declaration trim()
$params["gp1"] = trim($gp1);
$params["gp2"] = trim($gp2);
$params["gp3"] = trim($gp3);
#print results
}
echo '<img src="$gp1" border=0>';
?>

As you can see, path123 is the name of the folder and $percorso is the path of the database.txt. With that code I should load the 3 URLs in 3 different variables (gp1, gp2 and gp3).

My problem is that when I use echo '<img src="$gp1" border=0>' mozilla gives me an error here that says "syntax error, unexpected $end". So I can't show on the screen the 1st URL on my database.txt file. Any help?

3
  • 2
    you didn't close your while Commented Jul 8, 2013 at 14:10
  • fixed. By the way I still can't see the image Commented Jul 8, 2013 at 14:12
  • Can you show us the resulting HTML? Commented Jul 8, 2013 at 14:12

2 Answers 2

3

Change

list($gp1, $gp2, $gp3) = split("[:]", $value); //will output http://

to

list($gp1, $gp2, $gp3) = split("[-]", $value); //will output http://linkhere.tld
Sign up to request clarification or add additional context in comments.

Comments

2

Change

echo '<img src="$gp1" border=0>';

To

echo '<img src="'.$gp1.'" style="border: none;" />';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.