Jump to content
Sign in to follow this  
brainonastick

Echoing a link in an if statement

Recommended Posts

Hi there,

I want to use an if statment to determine which of 2 html links is displayed. Heres my code so far:

<?php if ($UN_CheckData['Internal_or_External'][0] == 'External') {

echo '.'">Show Me All CCWT Courses I am Presenting this Year'. ; }

if ($UN_CheckData['Internal_or_External'][0] == 'Internal') {

echo '.'">Show Me All CCWT Courses I am Presenting this Year'. ; } ?>

What am I doing wrong?

Share this post


Link to post
Share on other sites

It's hard to tell, but it looks like you have a "." outside the single quote for the echo statement. You also appear to have nested <?php...

Also, I'd make the second "if" into "else if", that way there it clearly only ONE choice of the two.

Invest in a color-coding editor and you'll see some of the mistakes!


<?php

	if ($UN_CheckData['Internal_or_External'][0] == 'External') {

		echo 'Show Me All CCWT Courses I am Presenting this Year'; 

	} else if ($UN_CheckData['Internal_or_External'][0] == 'Internal') {

		echo 'Show Me All CCWT Courses I am Presenting this Year';

	} 

?> 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.