Click to See Complete Forum and Search --> : Make it work, please


jkix
01-03-2008, 08:09 PM
I'm looking to insert the following code into the attached code. I do not have the proper php background to understand why it does not work for me.

PHP Code:

$link = '';
$host = strtoupper( stripslashes( $_REQUEST['host'] ) );

switch( $host )
{
case "ABC":
$link = '<a href="http://abc.com">abc link</a>';
break;
case "DEF":
$link = '<a href="http://def.com">def link</a>';
break;
case "GHI":
$link = '<a href="http://ghi.com">ghi link</a>';
break;
default
$host = 'ERROR!';
$link = '<b>invalid link specified</b>';
}

print 'You have selected '. $host .' so here\'s your link: '. $link;

TheBearMay
01-04-2008, 06:09 AM
So what sort of error are you getting?

myanavrin
01-04-2008, 08:46 AM
missing : in default

stephan.gerlach
01-04-2008, 08:47 AM
$link = '';
$host = strtoupper( stripslashes( $_REQUEST['host'] ) );

switch( $host )
{
case "ABC":
$link = '<a href="http://abc.com">abc link</a>';
break;
case "DEF":
$link = '<a href="http://def.com">def link</a>';
break;
case "GHI":
$link = '<a href="http://ghi.com">ghi link</a>';
break;
default :
$host = 'ERROR!';
$link = '<b>invalid link specified</b>';
}