PDA

View Full Version : PHP error



coolblu
July 25th, 2001, 12:01
I am trying to create a page a visitor sees before they leave my website. (eg. page.php?id=http://www.theurl.whatever - To contain a goodbye message etc)

So far I have this;


<?php
if ($id) {
echo "<br>";
echo "<br>";
$idt="click here to visit <b>$link</b>";
# print out the link.
echo "<a href=$id>$idt<a/>";
echo "<br>";
echo "<font color=red face=arial size=2>";
echo "<b>$idt</b>";
echo "</font>";
echo "<br>";
}
else {
print "no argument.";

?>

This however does not work, and returns a parse error. Can any one help?

Thanks

Blu :rolleyes:

(also: is it possible to add a text variable such as page.php?id=http://www.theurl.whatever&text=This is the text to display, or can this not be done? - Any help is much appreciated :))

niv
July 25th, 2001, 12:04
you forgot the last curly brace after the else statement: }

lucifer
July 25th, 2001, 12:13
Originally posted by coolblu

(also: is it possible to add a text variable such as page.php?id=http://www.theurl.whatever&text=This is the text to display

<?php
if ($id ) {
echo "<br>";
echo "<br>";
# decode text
if ($text){
$text=rawurldecode($text);
} else {
$text=$id;
}
$idt="click here to visit <b>$text</b>";
# print out the link.
echo "<a href=$id>$idt<a/>";
echo "<br>";
echo "<font color=red face=arial size=2>";
echo "<b>$idt</b>";
echo "</font>";
echo "<br>";
}
else {
print "no argument.";
}
?>

will use url as text if no text given

text must be url encoded

ie 'this is a link' becomes 'this+is+a+link'