Jump to content

Echoing a link in an if statement


This topic is 5307 days old. Please don't post here. Open a new topic instead.

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?

Link to comment
Share on other sites

  • 3 months later...

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';

	} 

?> 

Link to comment
Share on other sites

This topic is 5307 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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