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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:29:41+00:00 2026-05-23T12:29:41+00:00

I am trying to submit a form that only has a radiobutton group with

  • 0

I am trying to submit a form that only has a radiobutton group with name=radiob. This is the script I am using for submitting data:

<script type="text/javascript">
    $(function() {
        $("#myForm").submit(function() {
            var dataString = $(this).serialize();
            $.ajax({
                type: "POST",
                url: "index.php?p1=<?php echo $_GET['p1']; ?>",
                data: dataString,
                success: function() {
                    $("#ppm").fadeOut("slow");
                    $("#ppmPlugin").load('?p1=<?php echo $_GET['p1'];?>&result=true');
                }
            });
            return false;
        });
    });
</script>

But this is what I get in my PHP script:

$_POST array – empty

Array ( )

$_GET array

Array ( [p1] => xxx [result] => true )

But if I alert(dataString); I get radiob=2, that is, the value depending on the radiobutton selected..

How do I fix this problem?

  • 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-23T12:29:41+00:00Added an answer on May 23, 2026 at 12:29 pm

    I’ve tested your code and it works fine. Perhaps you have some kind of redirect in index.php?p1=xxx.

    P.S. Tested with this code:

    <?php $_GET['p1'] = 1; ?>
    <form id="myForm">
        <input type="radio" name="radiob" value="1" />
        <input type="radio" name="radiob" value="2" />
    
        <input type="submit" value="Submit" />
    </form>
    <script type="text/javascript">
        $(function() {
            $("#myForm").submit(function() {
                var dataString = $(this).serialize();
                $.ajax({
                    type: "POST",
                    url: "index.php?p1=<?php echo $_GET['p1']; ?>",
                    data: dataString,
                    success: function(data) {
                        alert(data);
                    }
                });
                return false;
            });
        });  
    </script>
    

    And in index.php I have

    <?php var_dump($_GET, $_POST); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to submit a form with the FormPanel using the Action class
I am trying to submit data to a database. I have an update form
I'm trying to submit a form with javascript. Firefox works fine but IE complains
Well I am trying to submit a form by pressing enter but not displaying
I'm trying to use jquery to enable a form button only after a radio
I have a form that is added through the nodeapi displayed only on view
I am working on a basic app that has a public facing form (for
I'm trying to execute I have an html form in a page of this
I have a rails 3 form that has 100+ questions. Each time a radio
I'm trying to submit a form with AJAX through jQuery: $('.submit input').click(function() {return false;});

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.