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

  • Home
  • SEARCH
  • 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 6235501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:40:42+00:00 2026-05-24T10:40:42+00:00

i have a problem when it comes to retrieving value from jQuery to php.i

  • 0

i have a problem when it comes to retrieving value from jQuery to php.i was able to get the value of my select and pass it to my php but i can’t pass it back to php. here is the code…

 <script>
  $(document).ready(function()
  {
       $("select#months").change(function(event)
       {
         var m=$(this).val();
          $.ajax({
               type: 'POST',
           url: "monthly_CRD.php",
           data: {m: m},
               success: function(){alert("updated")}
    });
       });
  });
</script>   


<div>
<select id="months">
  <option value='00'>Month...</option>
      <option value='01'>Jan</option>
      <option value='02'>Feb</option>
      <option value='03'>Mar</option>
      <option value='04'>Apr</option>
    </select>
    <select id="years">
    <?php
     for($yr=10; $yr<=$year; $yr++)
{
    echo "<option value='".$yr."'>".$years[$yr]."</option>";
}
?>
   </select>
</div>
<?php
 if (isset($_POST['m'])) 
 {
        $m = $_POST['m'];
        echo $m;
 } else   {echo "fail";} 

?>

it keeps on returning fail which means that isset is not working.

  • 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-24T10:40:43+00:00Added an answer on May 24, 2026 at 10:40 am

    If you mean that on page load, it returns fail, that is because on page load your $_POST array is probably empty.

    If you want to know what was returned from your AJAX post, you need your success function to accept a parameter (like data) that jQuery will fill with the response to your post.
    Then in the function body, you can write it to the DOM or your error console.

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

Sidebar

Related Questions

One problem that I come across regularly and yet don't have a solution to
I have encountered a problem that I have not come accross yet when setting
I have come across what must be a common problem. When I have an
When have you ever personally come upon the halting problem in the field? This
I've been thinking about this problem for a while and have yet to come
I am currently trying to learn C and I have come to a problem
When writing GUIs, I've frequently come over the following problem: Assume you have a
I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.
I have problem in some JavaScript that I am writing where the Switch statement
wonder whether someone can help me with the following one... I have a struct

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.