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 7027821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:17:57+00:00 2026-05-28T00:17:57+00:00

I have a form that submits an email address into my db and it

  • 0

I have a form that submits an email address into my db and it works fine except if I wanna put more then one of them on a page. When I do that then it forces me to put the info in on what ever form is hirer up in the html. The code I have is the following:

$('#signup').submit(function() {
    $('#response').html('Adding email address...');

    $.ajax({
        url: 'send.php',
        data: 'ajax=true&email=' + escape($('#email').val()),
        success: function(msg) {
            $('#signupResponse').html(msg);
        }
    });

    return false;
});

HTML:

<form id="signup" class="clear" action="" method="get">
    <label for="mce-EMAIL">Get the latest Poster Facts!</label>
    <input type="submit" value="Hit Me" class="signupButton" name="subscribe" id="mc-embedded-subscribe">
    <input type="text" name="email" class="signupEmail" alt="Enter Email Address" />
</form>  
<span id="signupResponse"></span>

Now for me the easiest way I can think of fixing this would be to put the same exact code but change #signup and #signupResponse to something else but I figure there has got to be a better way.

Thanks for the help

  • 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-05-28T00:17:57+00:00Added an answer on May 28, 2026 at 12:17 am

    Changing #signup and #signupResponse would work, and if you only have two forms, you could certainly do that.

    If you want to make a generic version, you could do that with classes. Change #signup to .ajaxForm (or something like that). Depending upon where #signupresponse is, you can do something like .parent() or .children(‘.response’) to refer to it. You can also use $(this) within the function to refer to the form that was selected, not all forms.

    So for example, if your structure is

    <div class="ajax-form">
        <form>
        ...
        <input type="text" name="email" class="email" />
        <input type="submit" value="Submit" />
        </form>
        <span class="response"></span>
        <span class="signup-response"></span>
    </div>
    

    You could do :

    $('.ajax-form form').submit(function() {
        $(this).parent().children('.response').html('Adding email address...');
    
        $.ajax({
            url: 'send.php',
            data: 'ajax=true&email=' + escape($(this).children('.email').val()),
            success: function(msg) {
                $(this).parent().children('.signup-response').html(msg);
            }
        });
    
        return false;
    });
    

    This generic format gives you one javascript for two forms.

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

Sidebar

Related Questions

I have a website with an existing form, that submits an email address to
i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect
I have a form that I want to ensure the paypal email address is
I have a form on my website that is submitted to my email address;
Hi have a small entry form that is jquery driven. It works fine on
I have a form that submits a search for blogs on my site via
i have a form that submits data to a database, i have a function
I have a js and html form that submits through php. Once submitted, the
I have a web form that collects information and submits it to a cgi
I have a simple form in python + pylons that submits to a controller.

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.