We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

registration form in light box

<html>
<head>
<title>Contact form</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
$(document).ready(function() {  
    var RecaptchaOptions = {
        theme : 'custom'
    };
    Recaptcha.create('your public key', 'recaptcha_image', RecaptchaOptions);
    Recaptcha.focus_response_field();
    $('#submit_button').click(function() { 
        $.ajax({
            type: 'POST',
            url: 'coustomer_rgistration.php',
            data: $('form#myform').serialize(),
            dataType: 'json',
            beforeSend: function() {
                var resp_field = $('#recaptcha_response_field').val();
                var name = $('#name').val();
                var email = $('#email').val();
                var pass = $('#pass').val();
                var add = $('#add').val();
                var zip_code = $('#zip_code').val();
                var l_number = $('#l_number').val();
                var m_number = $('#m_number').val();
                var city = $('#city').val();
                var state = $('#state').val();
                var country = $('#country').val();
                if (!resp_field[0] || !name[0] || !email[0] || !pass[0] || !zip_code[0] || !l_number[0] || !m_number[0] || !city[0] || !state[0] || !country[0]) { 
                    $('#output').html('All fields are required');
                    return false; 
                }
                emailpat = /^([a-z0-9])+([\.a-z0-9_-])*@([a-z0-9])+(\.[a-z0-9_-]+)+$/i;
                if (!emailpat.test(email)) {
                    $('#output').html('The e-mail address is not valid.'); 
                    return false;
                }
            },
            success: function(response) {
                if (response.status == 'success') {
                    $('#formcont').html();
                }
                $('#output').html(response.errmessage);
            }
        });

    });
}); 
</script>
</head>
<body>
    <h1>Contact form</h1>
    <div id="formcont">              
        <form id="myform">
            <p>
                <label for="naam">Name:</label>
                <input type="text" name="name" id="name" size="30" />
            </p>
            <p>
                <label for="email">E-mail:</label>
                <input type="text" name="email" id="email" size="30" />

            </p>
            <p>
                <label for="">Password:</label>
            <input type="password" name="pass" id="pass" size="30" />
            </p>
                <p>
                <label for="recaptcha_response_field">Address:</label>
        <input type="text" name="recaptcha_response_field" id="recaptcha_response_field" size="20" />
            </p>

                <p>
                <label for="">Zip code:</label>
            <input type="text" name="zip_code" id="zip_code" size="30" />
            </p>
                <p>
                <label for="">Land Line Number:</label>
            <input type="password" name="l_number" id="l_number" size="30" />
            </p>

                <p>
                <label for="">Mobile Number:</label>
            <input type="text" name="m_number" id="m_number" size="30" />
            </p>
                <p>
                <label for="">City:</label>
            <input type="text" name="city" id="city" size="30" />
            </p>
                <p>
                <label for="">State:</label>
            <input type="text" name="state" id="state" size="30" />
            </p>


                <p>
                <label for="">Country:</label>
            <input type="text" name="country" id="country" size="30" />
            </p>


            <div id="recaptcha_image"></div>
            <p>
                <!--<label for="recaptcha_response_field">address:</label>
                <input type="text" name="recaptcha_response_field" id="recaptcha_response_field" size="20" />-->
                <input type="button" value="Submit" id="submit_button" /> 
            </p>
        </form>
    </div>
    <div id="output"></div>
</body>
</html>

i m using light box form registration form i want to insert data in mysql database from light box but it is not work form shows in light box but data will not inserted into data base i m using another php code for inserting data in database what is the problem for this code pleas can any one help me....

5
Contributors
5
Replies
1 Day
Discussion Span
4 Months Ago
Last Updated
7
Views
Question
Answered
arti18
Posting Whiz in Training
206 posts since Dec 2012
Reputation Points: 2
Solved Threads: 25
Skill Endorsements: 0

What's the question?

pritaeas
Posting Prodigy
Moderator
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86

i m using light box form registration form i want to insert data in mysql database from light box but it is not work form shows in light box but data will not inserted into data base i m using another php code for inserting data in database what is the problem for this code pleas can any one help me....

Could you rephrase the issue and perhaps use some punctuation. I ran out of breath half way through the paragraph.

diafol
Keep Smiling
Moderator
10,611 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,506
Skill Endorsements: 57

There are some steps that you can do to verify where the problem lies:

  1. Debug the JavaScript code with your browser to see if $("form#myForm").serialize() is returning what is expected.
  2. Use your browser network watcher to ensure that the data is being sent
  3. Debug your PHP code to ensure that the data is recieved

If the data is recieved in your PHP code then is just a matter of validating the data and inserting into the DB.

Good luck.

AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23

i just want to insert data in data base from light box i have another php file in which i put myinsert code it work s fine but i do some mistake in ajax and jquery i m not familir with ajax and jquery please give some idea how i can insert values in databse from light box

arti18
Posting Whiz in Training
206 posts since Dec 2012
Reputation Points: 2
Solved Threads: 25
Skill Endorsements: 0

thanx to all of you to reply me my problem is solved

arti18
Posting Whiz in Training
206 posts since Dec 2012
Reputation Points: 2
Solved Threads: 25
Skill Endorsements: 0
Question Answered as of 4 Months Ago by pritaeas, diafol and AleMonteiro

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1035 seconds using 2.79MB