About modifying the content of an HTML file through php before loading the HTML file -
say instance want go main log in page html/js if password/username fail match when run php. able access main login html page , make div contains error message visible.
here code snippets example. works fine, don't how can load index page without telling user went wrong. i've been doing googling haven't managed right.
<?php //this in separate file "checklogin.php" . . . if ($count == 1) { session_start(); $_session['loggedin'] = true; header('location: loggedin.php'); } else { header('location: index.php'); } . . . ?> <html> //separate file "index.php" <body> . . . <div id = "nomatch" name = "nomatch" style = "display:none"> <p> username , password don't match </p> </div> . . . </body> </html>
you add parameter index.php redirect :
header('location: index.php?error');
your index.php becoming :
<?php if (isset ($_get['error'])) { ?> <div id = "nomatch" name = "nomatch" style = "display:none"> <p> username , password don't match </p> </div> <?php } ?>
Comments
Post a Comment