m@m Posted July 25, 2011 Share Posted July 25, 2011 I use this javascript validation in my form.. http://www.tizag.com/javascriptT/javascriptform.php but without validation values go to database.. Can anyone guide me how to solve this? First i import javascript file like this.. <script type="text/javascript" src="validate.js"></script> My code goes like this.... [m] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>HotWebsiteTemplates.net</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="js/jquery.js" type="text/javascript"></script> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/georgia.js"></script> <script type="text/javascript" src="js/cuf_run.js"></script> <script type="text/javascript" src="validate.js"></script> <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> <!--<script type="text/javascript" src="js/jquery-1.6.min.js"></script>--> <script type="text/javascript" src='js/jquery-ui-1.8.10.custom.min.js'></script> <script type="text/javascript" src="js/jquery.cookie.js"></script> <script type="text/javascript" src="js/jquery.tools.min.js"></script> <!--<script src="js/jquery.validationEngine-en.js" type="text/javascript"></script> <script src="js/jquery.validationEngine.js" type="text/javascript"></script> --> <script type="text/javascript"> $(function() { $( "#accordion" ).accordion({ <!--event: "mouseover" --> }); }); </script> <script type="text/javascript"> $(function() { $( "#accordion_1" ).accordion({ <!--event: "mouseover" --> }); }); </script> <script type="text/javascript"> $(function() { $( "#accordion_2" ).accordion({ <!--event: "mouseover" --> }); }); </script> <script type="text/javascript"> $(function() { $( "#tabs" ).tabs(); }); </script> <script type="text/javascript"> $(function() { $( "#datepicker" ).datepicker(); }); </script> <!-- Jquery UT - Start CSS --> <link rel="stylesheet" href="css/jquery-ui-1.8.14.custom.css" /> <link rel="stylesheet" type="text/css" href="http://static.flowplayer.org/tools/css/tooltip-generic.css"/> <!--<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>--> <style> /* simple css-based tooltip */ .tooltip { background-color: #06C; border:1px solid #fff; padding:10px 15px; width:150px; display:none; color:#fff; text-align:left; font-size:12px; font-weight:bold; font-style:italic; /* outline radius for mozilla/firefox only */ -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; } </style> <script> // execute your scripts when the DOM is ready. this is a good habit $(function() { // select all desired input fields and attach tooltips to them $("#reg :input").tooltip({ // place tooltip on the right edge position: "center right", // a little tweaking of the position offset: [-2, 10], // use the built-in fadeIn/fadeOut effect effect: "fade", // custom opacity setting opacity: 0.8 }); }); </script> <script>/* jQuery(document).ready(function(){ // binds form submission and fields to the validation engine jQuery("#reg").validationEngine(); }); */ </script> <![endif]--> </head> <body> <div class="main"> <div class="header"> <div class="header_resize"> <div class="logo"><h1><a href="index.html"><small>put your slogan here</small>worker <span>company</span></a></h1></div> <div class="clr"></div> <div class="search"> <form id="form1" name="form1" method="post" action=""> <span> <input name="q" type="text" class="keywords" id="textfield" maxlength="50" value="Search..." /> </span> <input name="b" type="image" src="images/search.gif" class="button" /> </form> </div> <div class="menu"> <ul> <li><a href="index.html" class="active">Home</a></li> <li><a href="services.html">Services</a></li> <li><a href="about.html"> About Us </a></li> <li><a href="contact.html"> Contact Us</a></li> </ul> </div> </div> <div class="clr"></div> </div> <div class="clr"></div> <div class="body"> <div class="body_resize"> <div class="left"> <center> <br /> <br /> <br /> <br /> <div id="tabs" style="width:600px; height:620px; font-size:12px; font-family:Arial, Helvetica, sans-serif" > <ul> <li><a href="#tabs-1">Doctor Registration</a></li> <li><a href="#tabs-2">Nurse Registration</a></li> <li><a href="#tabs-3">Pharmacist Registration</a></li> <li><a href="#tabs-4">Minor staff Registration</a></li> </ul> <div id="tabs-1" style="font-size:10px"> <br/> <br/> <form action="Process_reg.php" method="post" name="reg" id="reg" onsubmit="return formValidator()"> <div id="accordion" style="width:400px; height:500px; font-size:12px; font-family:Arial, Helvetica, sans-serif"> <h3><a href="#">General Details</a></h3> <div> <table cellpadding="5px" cellspacing="5px"> <tr> <td>First name</td> <td><input type="text" name="fname" id="fname" size="20px" title="Must be at least 8 characters." /></td> </tr> <tr> <td> Last name</td> <td><input type="text" name="lname" id="lname" size="20px" title="Enter Last Name" /></td> </tr> <tr><div class="Demo"> <td> DOB</td> <td><input type="text" name="bod" id="datepicker" size="20px" title="Select Date" /></td></div> </tr> <tr> <td>Address 1</td> <td><input type="text" name="add1" id="add1" size="20px" title="Enter Address" /></td> </tr> <tr> <td>Address 2</td> <td><input type="text" name="add2" id="add2" size="20px" title="Enter Address" /></td> </tr> <tr> <td>Address 3</td> <td><input type="text" name="add3" id="add3" size="20px" title="Enter Address" /></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" id="email" size="20px" title="Enter Valid Email Address" /></td> </tr> <tr> <td>TP(Land)</td> <td><input type="text" name="tp_l" id="tp_m" size="20px" title="Home Phone" /></td> </tr> <tr> <td>TP(Mobile)</td> <td><input type="text" name="tp_m" id="tp_m" size="20px" title="Mobile Number" /></td> </tr> <tr> <td>Hospital</td> <td><select name="hospitals" id="hospitals" title="select a hospital"> <option>Select hospital</option> <?php $con = mysql_connect("localhost","chathura","123456"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("hospital", $con); $result = mysql_query("SELECT addr_1 FROM hospital"); while($row = mysql_fetch_array($result)) { ?> <option> <?php echo $row['addr_1']; ?> </option> <?php } ?> </select></td> </tr> <!-- <tr> <td>Employee Type</td> <td><select name="Employee_types" id="Employee_types" title=""> <option>Doctor</option> <?php // $con = mysql_connect("localhost","chathura","123456"); //if (!$con) //{ //die('Could not connect: ' . mysql_error()); //} //mysql_select_db("hospital", $con); //$result = mysql_query("SELECT name FROM emp_type"); //while($row = mysql_fetch_array($result)) //{ ?> <option> <?php //echo $row['name']; ?> </option> <?php // } ?> </select></td> </tr>--> <tr> <td>Image</td> <td><input type="file" name="img_search" id="img_search" size="20px" /></td> </tr> </table> </div> <h3><a href="#">Account details</a></h3> <div> <table cellpadding="5px" cellspacing="5px" > <tr> <td>Username</td> <td><input type="text" name="usr" id="usr" size="20px" title="Enter Username" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="psw" id="psw" size="20px" title="Use Strong Password" /></td> </tr> </table> </div> <h3><a href="#">Speciality Details</a></h3> <div> <table cellpadding="5px" cellspacing="5px"> <tr> <td> Education </td> <td><input type="text" name="edu" id="edu" size="20px" title="Eg:MBBS,FRCS" /></td> </tr> <tr> <td> Speciality </td> <td><input type="text" name="spec" id="spec" size="20px" title="Eg:Surgeon" /></td> </tr> <tr> <td> Speciality details </td> <td><input type="text" name="spec_data" id="spec_data" title="Eg:Surgeon-VOG" size="20px" /></td> </tr> <tr> <td></td> <td><input type="submit" name="sbt" id="sbt" value="Register" size="20px" /> <input type="reset" name="reset" id="reset" value="Reset" size="20px" /></td> </tr> </table> </div> </div> </form> </div> <div id="tabs-2" style="font-size:10px"> <form action="Process_reg.php" method="post" name="reg" id="reg"> <div id="accordion_1" style="width:400px; height:500px; font-size:12px; font-family:Arial, Helvetica, sans-serif"> <h3><a href="#">General Details</a></h3> <div> <table cellpadding="5px" cellspacing="5px"> <tr> <td>First name</td> <td><input type="text" name="fname" id="fname" size="20px" /></td> </tr> <tr> <td> Last name</td> <td><input type="text" name="lname" id="lname" size="20px" /></td> </tr> <tr><div class="Demo"> <td> BOD</td> <td><input type="text" name="bod" id="datepicker" size="20px" /></td></div> </tr> <tr> <td>Address 1</td> <td><input type="text" name="add1" id="add1" size="20px" /></td> </tr> <tr> <td>Address 2</td> <td><input type="text" name="add2" id="add2" size="20px" /></td> Quote Link to comment https://forums.phpfreaks.com/topic/242718-problem-on-validation/ Share on other sites More sharing options...
trq Posted July 25, 2011 Share Posted July 25, 2011 Please, we have tags for use when posting code. Now, are you asking for help with PHP or Javascript? This is the PHP Help board, yet there doesn't appear to be much PHP in your code. Quote Link to comment https://forums.phpfreaks.com/topic/242718-problem-on-validation/#findComment-1246663 Share on other sites More sharing options...
m@m Posted July 25, 2011 Author Share Posted July 25, 2011 i'm new here thats why this mistake :'( i'll post it there .. thx Quote Link to comment https://forums.phpfreaks.com/topic/242718-problem-on-validation/#findComment-1246674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.