Jump to content

Validation form


Sigmahokies

Recommended Posts

Hi everyone,

I am trying to have validation form, seem it doesn't work. what did I do wrong?

If anyone can help, Thank you so much...

Gary Taylor

	<?php
	$buzz = $buzz2 = "";
	if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (empty($_POST['select'])) {
        $buzz = "<h2><color ='red'> >- </color></h2>";
        $buzz2 = "<h2><color ='red'> -< </color></h2>";
    }
}
	?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Welcome to ASL-PT Scoring</title>
    <link href="default.css" rel="stylesheet" type="text/css">
</head>
<body>
<fieldset>
<h1>Welcome to ASL-PT Scoring website</h1>
    <table>
        <form action="login.php" method="post">
            <select name="select">
                <?php echo $buzz ?><option value="" >Please select the level</option><?php echo $buzz2 ?>
                <option value="Administrator">Administrator</option>
                <option value="License">License</option>
                <option value="Scorer">Scorer</option>
            </select>
        <caption>Please login to enter the site below:</caption>
        <tr><td>Username:</td><td class="td"><input type="text" name="user"></td></tr>
        <tr><td>Password:</td><td class="td"><input type="password" name="password"></td></tr>
        <tr><td colspan="2"><input type="submit" name="submitted" value="Login"></td></tr>
        </form>
    </table>
</fieldset>
</body>
</html>
	
Edited by Sigmahokies
Link to comment
Share on other sites

What do you mean it doesn't work, what happens?  One thing to be aware of is that if you want to print "<" or ">" on an HTML page, you need to use the character entity.  The browser uses those characters to represent HTML tags.  If you're trying to print the actual character use the HTML entity for that character.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...