Link to home
Create AccountLog in
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

ASKER CERTIFIED SOLUTION
Avatar of kwingherrero
kwingherrero
Flag of Philippines image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of brendan-amex
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.