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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:09:05+00:00 2026-05-29T04:09:05+00:00

I have a form like this <form action=formprocess1.php> <input type=text name=firstname> <input type=text name=email>

  • 0

I have a form like this

<form action="formprocess1.php">
<input type="text" name="firstname">
<input type="text" name="email">
<input type="checkbox" name="newsletter" value="1">
<input type="submit" name="submit">
</form>

If the checkbox is checked on first form i want to trigger another form

<form action="newsletter.php">
<input type="text" name="firstname">
<input type="text" name="email">
<input type="submit" name="submit">
</form>

Can anyone give me some php code or javascript code to auto trigger it?
Thanks

  • 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-29T04:09:06+00:00Added an answer on May 29, 2026 at 4:09 am

    You cannot trigger two forms at once as you can only send one request to a PHP page at once, unless you are using AJAX.

    The solution here would be to hide the second form unless the checkbox is attached, and show it as part of the first form when the checkbox is checked.

    Would you like me to demonstrate how you can do this?

    Update

    Showing/hiding the newsletter form on change of the checkbox state:

    HTML:

    <form>
        <input type="text" name="firstname">
        <input type="text" name="email">
        <input type="checkbox" name="newsletter" value="1">
        <div id="newsletter" style="display:none;">
             <input type="text" name="news-firstname">
             <input type="text" name="news-email">
        </div>
        <input type="submit" name="submit">
    </form>
    

    Javascript (jQuery):

    // Set the onchange event for the checkbox
    $('input[name="newsletter"]').change(function(){
        // Test is checkbox is checked
        if($(this).is(':checked')){
            // If it is checked then show the newsletter
            $('#newsletter').show();
        }else{
            // If it is not checked then hide the news letter
            $('#newsletter').hide();
        }
    })
    

    I have not tested the above but it should work, if there are any bugs, let me know and I will fix them. I have clearly set out comments to explain what each step is doing.

    In your PHP script you must then test to see if the checkbox is checked, and then validate accordingly. Otherwise you will always receive the newsletter information. Just because they are hidden does not mean they are not submitted.

    I would advise combining both of your separate PHP scripts into one file, this will make it much simpler for you.

    The alternative to this is AJAX, which is a little more complex but it is good practice as more and more people are using it nowadays. If you would like to see an example of this then let me know.

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

Sidebar

Related Questions

I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have a page like this: <form class=ajax method=post action=add_item.php> [text input] [submit button]
I have an input in Struts 2 form like this: <s:form action=Action> <input type=text
I have a php form like this. <form name=form1 id=mainForm method=postenctype=multipart/form-data action=<?php echo $_SERVER['PHP_SELF'];?>>
My Form looks like this: <body> <form id=myForm method=post> <label>id:</label> <input type=text name=id id=id
I have a form like this: <form id=loginCompact action=https://externalsite... name=sportsbook method=post onsubmit=createCookie('BRLOG', document.sportsbook.username.value, 1)>
I have a html form like this : <form action=https://www.123.com/cgi-bin/action method=post> <input type=hidden name=item_name
I have a form like this: <form id=form_main name=form_main action=/search/ target=iframe001 method=get onSubmit=reset_and_subm();> Enter
I have situation like this: user submits form with action='/pay' in '/pay' I have

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.