ho trovato questo script che mi fa dei controlli du dei dati in input in maniera asincrona
solo che non riesco dopo aver premuto invio a scriverli sul database come si fa?
Codice PHP:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery UI tabs integration demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="style/style.css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery-ui.min.js" type="text/javascript"></script>
<script src="lib/jquery.validate.js" type="text/javascript"></script>
<script id="demo" type="text/javascript">
$(document).ready(function() {
var tabs = $("#tabs").tabs();
var validator = $("#signupform").validate({
groups: {
birthdate: "birthdateDay birthdateMonth birthdateYear"
},
errorPlacement: function(label, element) {
if (/^birthdate/.test(element[0].name)) {
label.insertAfter("#birthdateYear");
} else {
label.insertAfter(element);
}
}
});
// validate the other two selects when one changes to update the whole group
var birthdaySelects = $("#birthdateGroup select").click(function() {
birthdaySelects.not(this).valid();
})
// overwrite focusInvalid to activate tab with invalid elements
validator.focusInvalid = function() {
if( this.settings.focusInvalid ) {
try {
var focused = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible");
tabs.tabs("select", tabs.find(">div").index(focused.parent().parent()));
focused.focus();
} catch(e) {
// ignore IE throwing errors when focusing hidden elements
}
}
};
});
</script>
<style>
body { font-size: 65.2% }
label { display: inline-block; width: 8em; }
label.error { color: red; margin-left: 0.5em; width: 20em; }
</style>
</head>
<body>
<form action="ciao.php" id="signupform" method="post">
<div id="tabs">
<ul>
[*][url="#logindata"]Login data[/url]
[/list]
<div id="logindata">
<label for="username">Username</label>
<input id="username" name="username" class="required" minlength="3" maxlength="20" type="text" />
</p>
<label for="email">Email address</label>
<input id="email" name="email" class="required email" type="text" />
</p>
<label for="password">Password</label>
<input name="password" type="password" class="required" id="password" minlength="4" maxlength="50" />
</p>
<label for="confirmpassword">Confirm Password</label>
<input name="confirmpassword" type="password" class="required" equalTo="#password" id="confirmpassword" />
<input type="submit" />
</p>
</div>
</body>
</html>