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"> 
    <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">
            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) {
    label.error { width: 250px; display: inline; color: red;}
<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=""/>  
<!-- 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=""/> 
<!-- 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>

<!-- 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>

<!-- 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>


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

Recommended Answers

All 2 Replies

you've post this article twice man ..

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.