troubleshooting Question

Adding HTML Code Inside PHP If Else Statement

Avatar of brendan-amex
brendan-amex asked on
HTMLPHP
3 Comments2 Solutions323 ViewsLast Modified:
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";
	}
	
?>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros