Skip to content
Advertisement

PHP, simple banner pop up in else statement

I have a simple if/else for a php login of sorts:

if($message == 1){
    header('root.php');
}else{
    echo('no username');
}

However, I want to make it so that within that else it shows a somewhat nice looking banner on the existing page, as now it just shows the text on a white blank page (as echo should be expected to do)

What’s the most simple way to just stay on the page and flash html if the else is met?

Advertisement

Answer

Replace the echo with the HTML of the banner. If you want to output pure HTML, then close the Php tag within the else statement. For example:

if($message == 1){
    header('root.php');
}else{
?>
   HTML for the banner
<?
}
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement