i want that when user type username in from fiel it validate from process.php and after validate it show result in front of name field . i want that when user select uk from contry it show uk city and if selected india then show india cities how can it possiable with jquery and if any fiel eppty it show an error

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
<head>
    <title>JQuery Form Example</title> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("#myform").validate({
            debug: false,
            rules: {
                name: "required",
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                name: "Please let us know who you are.",
                email: "A valid email will help us get in touch with you.",
            },
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('process.php', $("#myform").serialize(), function(data) {
                    $('#results').html(data);
                });
            }
        });
    });
    </script>
    <style>
    label.error { width: 250px; display: inline; color: red;}
    </style>
</head>
<body>
<form name="myform" id="myform" action="" method="POST">  
<!-- The Name form field -->
    <div id='name'> </div>
    <label for="name" id="name_label">Username</label>  
    <input type="text" name="name" id="name" size="30" value=""/>  
    <br>
<!-- The Email form field -->
    <div id='email'> </div>
    <label for="email" id="email_label">Email</label>  
    <input type="text" name="email" id="email" size="30" value=""/> 
    <br>
<!-- The Country form field -->
    <div id='Select_option'> </div>
    <label for="country" id="country_label">Contry</label>  
<select name="contry">
<option value="uk">uk</option>
<option value="india">india</option>
</select>

    <br>
<!-- The Country form field -->
    <div id='uk_city'> </div>
    <label for="ukcity" id="ukcity_label">uk city</label>  
<select name="uk_city">
<option value="u0">u0</option>
<option value="u1">u1</option>
</select>

    <br>
<!-- The Country form field -->
    <div id='ind_city'> </div>
    <label for="indcity" id="indcity_label">ind city</label>  
<select name="ind_city">
<option value="i0">i0</option>
<option value="i1">i1</option>
</select>

    <br>


<!-- The Submit button -->
    <input type="submit" name="submit" value="Submit"> 
</form>
<!-- We will output the results from process.php here -->
<div id="results"><div>
</body>
</html>

If you want to create something like that you should use some json to make php return those valeus and your will have to use a sql database
you make a connection through php than you make your selection specifing username and password and than you use php to call jquery or json and continue your work in jquery

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.