how to show error message whenever the person enters wrong or empty text fields in th login form itself rather than linking to other error page? error message should be displayed just above the login text fields...
please pass me the codes so that i can understand.
thank you
vijukumar 0 Light Poster
Recommended Answers
Jump to Postyou can do it with javascript:
for example:
<script type="text/javascript"> function validate(form) { if (form.text1.value == "") { document.getElementById("txterror").innerHTML="missing fields"; return false; } } </script> <form name="form1" onsubmit="return validate(this);"> <p><span id="txterror"></span></p> <input type="text" name="text1" /> <input type="submit" name="submit"/> </form>
Jump to PostHere the code:
ndex.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Invoice System</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/styles.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br> <br> <br> <table width="36%" border="0" cellpadding="8" cellspacing="0" class="text"> <tr> <td align="center" class="logo"><img src="graphics/cr8invoice.gif" width="137" …
Jump to Posthere I made your validation part:Just insert the database insertion where I have placed the comment,ok?
<?php //if the user clicks submit button... if ($_POST['Submit']) { //check for missing fields if ($_POST['admin_name']=="") { $name_missing="missing fields"; } elseif($_POST['admin_password']=="") { $pass_missing="missing fields"; } else { //do your insertion in …
All 10 Replies
vijukumar 0 Light Poster
ryan_vietnow 13 Posting Pro
vijukumar 0 Light Poster
vijukumar 0 Light Poster
forzadraco 0 Junior Poster in Training
forzadraco 0 Junior Poster in Training
ryan_vietnow 13 Posting Pro
vijukumar 0 Light Poster
vijukumar 0 Light Poster
vijukumar 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.