1

This value of count is to be transferred to the php page orderdetail.php This is the javascript code that i am using,Please provide the solution.

 
    var count=10;
    $.post('orderdetail.php',{no_of_orders:count},function(){});

The php code i am using is

<?php
    $no_of_orders=$_POST['no_of_orders'];
    echo $no_of_orders; 
?>
9
  • pass count to no_of_orders, {no_of_orders: count} Commented Jul 20, 2017 at 18:34
  • What is new1 in your js? What the output of your php snippet? Commented Jul 20, 2017 at 18:36
  • @JosanIracheta where should i write it? Commented Jul 20, 2017 at 18:37
  • @simon.ro there is count instead of new1, the php snippet produces output of "undefined index:'no_of_orders' Commented Jul 20, 2017 at 18:39
  • You never stated the problem in your question. Commented Jul 20, 2017 at 18:40

2 Answers 2

1

Why don't you just use the php instead of including javascript for this purpose?

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

Comments

0

Using jQuery to set the value of the input field with the id myVal. Then you can send the value with the Form

JS/jQuery CODE

var count=10;
$('#myVal').val(count);

HTML/PHP CODE

<form action="orderdetail.php" method="POST">
<input type="hidden" value="" id="myVal" />
<input type="submit" value="Submit">
</form>

Hope this helps

1 Comment

just need to transfer count to the php page

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.