0

Sender page

$.ajax({
    type : "POST", // type of method
    url  : "1.php", // your page
    data : { PID : $PID, PQ : $ProductNeed }, // passing the values
    success: function(res) { }
});

Receiver Page

if (isset($_POST['PID'])) {
    $result = mysqli_query($conn, "call herestoredProcedure('".$_SESSION['USERid'])."','".$_POST['PQ']."','".$_POST['PID']."')";
    mysqli_close($conn);
}

_POST Not Receiving data of PID, PQ Indexer. Please help me to solve it.

6
  • what is the output of print_r($_POST); Commented Dec 15, 2018 at 21:19
  • 1
    If "_POST Not Receiving data of PID, PQ" , then you should check the $PID and $ProductNeed variables at the client side code. what does console.log($PID) and console.log($ProductNeed) show in your browser ? Commented Dec 15, 2018 at 21:26
  • how do i print because it is just send data to server for insert data in database Commented Dec 15, 2018 at 21:29
  • 2
    Time to use the debugging tools you have available to you. In your browser's debugger, place a breakpoint just before the AJAX call. Do the variables have the values you expect them to have? When the AJAX call is made, observe it in the browser's network debugging panel. Does the request have the values you expect? What is the server's response? In your server-side code, what happens when you print_r($_POST) or print_r($result) or echo mysqli_error($conn) and observe the output in your browser's network debugger? Does it contain what you expect? Commented Dec 15, 2018 at 21:33
  • AJAX Connected and variables data is accurate problem is when isset() function call to check values are there in 1.php then it returns false Commented Dec 15, 2018 at 21:40

2 Answers 2

1

You have a typo in URL parameter. It's not "1 .php" but "1.php". Also I do not advise you to name php files only by numbers.

Sign up to request clarification or add additional context in comments.

1 Comment

when i call 1.php without using posted values direct putting values in call storeprocedure all working properly but when i use posted values it return isset false
0

I have checked this one and it's working perfectly if you still got the problem try this I think your problem in path or something in my code all the files in same folder so check for that.

callto1.html

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

</head>
<body>

</div>

<script>
var $PID = 1;
var $ProductNeed=2;

$(document).ready(function(){
    $.ajax({
    url : "1.php", // your page
    type : "POST", // type of method
    data : { PID : $PID, PQ : $ProductNeed }, // passing the values
    success: function(res) {
        alert(res);
     }
});
});

</script>

</body>
</html>

1.php

<?php

if(isset($_POST['PID']) && isset($_POST['PQ'])){
    echo "came";
}

?>

3 Comments

Thanks the problem is now solved document.ready not used before
Your welcome next time post the whole code and name the files to it's easy for us to understand and give perfect answer to you... happy coding 😁😊
Ok i'll Remember

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.