Jump to content
Sigmahokies

Validation form

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...