I am trying to use the IF function, can someone tel me what is wrong with this below ( I am only using normal HTML in the body tags )
<?php
if($_GET['id'] == 'viewall'){
<html>
<head>
<body>
</body>
</html>
} else {
<html>
<head>
<body>
</body>
</html>
}
?>
When i try to view it it comes up with this error
Parse error: parse error, unexpected '<'
Its right at the beggining on line 3. Any suggestions?put the html and body tags OUTSIDE the php code:
<html>
<body>
<?php
code
?>
</body>
</html>i have done but whenever there is a < it comes up with the error above.You can't be putting it outside then. PHP will only return that error if there is a '<' inside the PHP tags.
Are you wanting it to write that html to the page in a conditional manner? Because if you are that code is missing the 'echo' function.
It would be echo("<html>");why do it twice?
<html>
<head>
<body>
<?
if($_GET['id'] == 'viewall'){
} else {
}
?>
</body>
</html>Originally posted by scoutt
why do it twice?
<html>
<head>
<body>
<?
if($_GET['id'] == 'viewall'){
} else {
}
?>
</body>
</html>
<?
if($_GET['id'] == 'viewall'){
MORE PHP HERE
}
All that goes in that section is just php and it shows up with an error on the line were the php starts ( <?php
Any sugestions?the code I posted doesn't have any errors in it. so what ever error you are getting is one that you made.
what si the full code?Doent matter Ive fixed it now thanks for all the help people :cheers:
<?php
if($_GET['id'] == 'viewall'){
<html>
<head>
<body>
</body>
</html>
} else {
<html>
<head>
<body>
</body>
</html>
}
?>
When i try to view it it comes up with this error
Parse error: parse error, unexpected '<'
Its right at the beggining on line 3. Any suggestions?put the html and body tags OUTSIDE the php code:
<html>
<body>
<?php
code
?>
</body>
</html>i have done but whenever there is a < it comes up with the error above.You can't be putting it outside then. PHP will only return that error if there is a '<' inside the PHP tags.
Are you wanting it to write that html to the page in a conditional manner? Because if you are that code is missing the 'echo' function.
It would be echo("<html>");why do it twice?
<html>
<head>
<body>
<?
if($_GET['id'] == 'viewall'){
} else {
}
?>
</body>
</html>Originally posted by scoutt
why do it twice?
<html>
<head>
<body>
<?
if($_GET['id'] == 'viewall'){
} else {
}
?>
</body>
</html>
<?
if($_GET['id'] == 'viewall'){
MORE PHP HERE
}
All that goes in that section is just php and it shows up with an error on the line were the php starts ( <?php
Any sugestions?the code I posted doesn't have any errors in it. so what ever error you are getting is one that you made.
what si the full code?Doent matter Ive fixed it now thanks for all the help people :cheers: