Reputation: 945
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?
Upvotes: 0
Views: 73
Reputation: 76636
Change
list($gp1, $gp2, $gp3) = split("[:]", $value); //will output http://
to
list($gp1, $gp2, $gp3) = split("[-]", $value); //will output http://linkhere.tld
Upvotes: 3
Reputation: 2790
Change
echo '<img src="$gp1" border=0>';
To
echo '<img src="'.$gp1.'" style="border: none;" />';
Upvotes: 2