Avatar of brendan-amex
brendan-amex
 asked on

Adding HTML Code Inside PHP If Else Statement

I have several if else statments that run some HTML and PHP code inside of them but it's not liking the < > symbols used in HTML. It makes sense that I should close the PHP before including the HTML code but then how can I run my If Else statement? Any help is greatly appreciated. The code is below and here's the error I get:


Parse error: syntax error, unexpected '<' in /home/content/b/m/c/brendan/html/test/mysql/everything.php on line 14
<?php
$select1 = $_POST['select1'];
$select12 = $_POST['select12'];

session_start();
$_SESSION['sessiontest'] = $select12;

$curdata = $_SESSION['sessiontest'];


if ($curdata=="all")
	{
	<a href="http://www.google.com">Click Here</a>
	}
	
elseif ($curdata=="podium")
	{
	<a href="http://www.yahoo.com">Click Here!</a>
	}
	
else 
	{
	echo "WRONG";
	}
	
?>

Open in new window

PHPHTML

Avatar of undefined
Last Comment
brendan-amex

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
kwingherrero

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
dsmile

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
brendan-amex

ASKER
Oh Lord, I feel silly. Close the PHP code, obviously. Thank you guys. You guys posted within 1 minute of each other, so I'm giving both points. Thanks.
Your help has saved me hundreds of hours of internet surfing.
fblack61