Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:53:16+00:00 2026-06-18T06:53:16+00:00

I have a registration form that is currently in a popup modal window coded

  • 0

I have a registration form that is currently in a popup modal window coded in jQuery. I have a PHP submit button on the bottom and I have added jQuery code that stops the button from submitting. This is because it will stop my modal window from closing when I submit the page. My issue now is that submitting the form would be impossible. Is there a way to submit my form over all this crowded pop-ups and jQuery? Say is it possible to use AJAX or jQuery to submit the form and allow my PHP to handle it.

Since I am writing in PHP, there is quite a bit of server side validation going on, so the point of this is to allow my viewers to fix their validation mistakes before the modal window closes.

Here is my jQuery, I didnt bother to mess with that anymore as it does what I need.

$(document).ready(function() {
    $('a.modal-window').click(function() {          
                //Getting the variable's value from a link 
        var loginBox = $(this).attr('href');   
        $(loginBox).fadeIn(300);        
        var popMargTop = ($(loginBox).height() + 24) / 2; 
        var popMargLeft = ($(loginBox).width() + 24) / 2;           
        $(loginBox).css({ 
            'margin-top' : -popMargTop,
            'margin-left' : -popMargLeft
        });         
        // Add the mask to body
        $('body').append('<div id="mask"></div>');
        $('#mask').fadeIn(300);         
        return false;
    });     
    // When clicking on the button close or the mask layer the popup closed
    $('a.close, #mask').live('click', function() { 
      $('#mask , .login-popup').fadeOut(300 , function() {
        $('#mask').remove();  
    }); 
    return false;
    });
});

Here is the code I used to stop the form from submitting:

$(function () {
    $(':submit').click(function (event) {
        event.preventDefault();
        // submit the form dynamically
    });
});

and below is my form, it might not matter although its there for the viewing.

<form method="post" id="loginform"  action="<?php echo $_SERVER['PHP_SELF']?>">
                <table style="color: white;">
                    <tr><th style="float:left;">Register a new account with us.</th></tr>
                    <tr><td>Username</td><td><input type="text" name="txtUser"/></td></tr>
                    <tr><td>Password</td><td><input type="text" name="txtPass"/></td></tr>
                    <tr><td>Email</td><td><input type="text" name="txtEmail"/></td></tr>
                    <tr><td>Confirm Email</td><td><input type="text" name="txtEmail2"/></td></tr>
                    <tr><td>First Name</td><td><input type="text" name="txtFname"/></td></tr>
                    <tr><td>Last Name</td><td><input type="text" name="txtLname"/></td></tr>
                    <tr><td>Address</td><td><input type="text" name="txtAddress"/></td></tr>
                    <tr><td>City</td><td><input type="text" name="txtCity"/></td></tr>
                    <tr><td>Postal Code</td><td><input type="text" name="txtPostal"/></td></tr>
                    <tr><td>Birth Year</td><td><input type="text" name="txtBirth"/></td></tr>
                    <tr><td>Gender</td><td><input type="radio" id="radio-1-1" name="radicalSex" class="regular-radio" value="m" selected="true" /><label for="radio-1-1"></label> Male</td></tr>
                    <tr><td></td><td><input type="radio" id="radio-1-2" name="radicalSex" class="regular-radio" value="f"/><label for="radio-1-2"></label> Female</td></tr>
                    <tr><td colspan='2' style="color: #FF6600;float:left;font-size:70%;"><?php echo $Error;?></td></tr>
                    <tr><td colspan="2"><input type="submit" name="btnRegister" ID="btnBlueTemp" value="Submit Registration" /></td></tr>
                    <tr><td colspan='2' style="float:left; font-size:70%;">Address information is optional</td></tr>
                </table>      
          </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:53:17+00:00Added an answer on June 18, 2026 at 6:53 am

    Let me give you an example of how you can do that .

    <html>
        <head>
        <title></title>
    
        <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script>
            $(document).ready(function(){ 
                function validate(name, addr){
                    if(name=="") {
                        alert('Name is Blank');
                        return false;
                    } else if(addr=="") {
                        alert('Address is Blank');
                        return false;
                    } else {
                        return true;
                    }
                }
                $("#save").click(function(event){ 
                    event.preventDefault();
                    var name = $("#name").val();
                    var addr = $("#addr").val();
                    if(validate(name,addr)){
                        $.ajax({
                            type:'POST',
                            data:'name='+name+'&addr='+addr,
                            url:'test2.php',
                            success:function(data) {
                                alert(data);
                            }
                        })  
                    }               
                });
            });
        </script>
        </head>
        <body>
        <form name="frm" method="POST" action="">
            <input  type="text" name="name" id="name" value=""/><br>
            <input type="text" name="addr" id="addr" value="" /><br>
            <input type="submit" name="save" id="save" value="Save"/>
        </form>
        </body>
    </html>
    

    Now in test2.php You can do your php codes

    <?php
        if(isset($_POST['name'])) {
            echo $_POST['name'];
        }
    ?>
    

    Hope this gives you an Idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a registration form. When I hit the Submit button it should check
I have a PHP site (with CodeIgniter) that includes a registration form. I have
I have a basic form that I'm using for member registration. I'm using the
I have a registration form that I am using to register new user. No
I have a user registration form that has a password and confirm password field.
I have a registration form that uses an old version of the FB API.
I have a registration form that has some required field. i want to check
I am currently trying to create a multi-page form that uses both jQuery and
I currently have a registration form which when clicked from a link opens up
Background I have a form that PHP generates from my database. The page is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.