Jovan Yong Jovan Yong - 2 years ago 84
Javascript Question

Check for empty field for my username and password

if ( isset( $_GET['fail']) && !empty($_POST["uname"]))
echo '<script language="javascript">';
echo 'alert("Your name or password is incorrect")';
echo '</script>';

How do I check for empty field when I press the submit button?

Answer Source

You could use required attribute of html5 in your input tag as

<input type="text" name="USERNAME" required>
<input type="text" name="PASSWORD" required>

This won't allow to submit form without content in the textbox.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download