/    Sign up×
Community /Pin to ProfileBookmark

Make it work, please

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;

[upl-file uuid=3d9adce0-e605-4e6d-9c4b-2acc65b00dd2 size=5kB]code.txt[/upl-file]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayJan 04.2008 — So what sort of error are you getting?
Copy linkTweet thisAlerts:
@myanavrinJan 04.2008 — missing : in default
Copy linkTweet thisAlerts:
@stephan_gerlachJan 04.2008 — [code=php]

$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>';
}
[/code]
×

Success!

Help @jkix spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...