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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:07:16+00:00 2026-06-12T11:07:16+00:00

I want to pass selected value on invoice.php file using jQuery. After sending value

  • 0

I want to pass selected value on invoice.php file using jQuery. After sending value on invoice.php file. I want to show invoice.php file echo result on index.php page selected input box. Like an example: If anyone select Item then rate show on rate input box. Here is my code and imageenter image description here

index.php file code:

<html>
    <head>
        <title>Invoice</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">

    $(document).ready(function(){
    $(".item").change(function(){
        calculate();
    });
});

function calculate() {

var item = [];
    $(".item").each(function() {
            var num=(this.value);
            item.push(num);
    });


    $('input[name=rate]').each(function(i){
        $.get(
            '/invoice_final_2.php',
            {'product':item[i]},
            function(data) {
                $(this).html(data);
            });
    });
}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
</script>
<style type="text/css">
table
{
    border: 1px solid black;
    border-bottom: none;
    width: 300px;
}


td
{
    border-left: 1px solid black;
    border-bottom: 1px solid black;
    padding:5px 5px 5px 5px;
}
#first
{
    border-left: none;
    border-bottom: 1px solid black;
}
</style>
    </head>
    <body>
        <form method='post' name='form1' action='welcome.php'>
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td id="first">Item</td>
                <td>Rate</td>
            </tr>
            <?php
            $num=4;
            for ($i=0; $i<$num; $i++)
            {
                echo "
                 <tr>
                 <td id='first'>
                 <select class='item' name='item'>
                 <option>Select one</option>
                 <option>Deluxe Plan</option>
                 <option>Premium Plan</option>
                 <option>Standard Plan</option>
                 <option>Economy Plan</option>
                 </select>
                </td>
                <td><input class='rate' type='text' name='rate'/></td>
               </tr>";
            }
            ?>
     </table>
</form>
</body>
</html>

invoice.php file code:

<?php
include "dbconnect.php";

$product=$_GET['product'];

$query="select * from item where item_name='$product'";
$result=mysql_query or die (mysql_error());
$row=mysql_fetch_assoc($result);
$rate=$row['rate'];

echo "$rate";

?>
  • 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-06-12T11:07:18+00:00Added an answer on June 12, 2026 at 11:07 am

    I’m not sure what you are trying to achieve, but you don’t need to use each and send values one by one using indexes, you can send the array once.

    function calculate() {
        var items = $(".item").map(function() {
              return this.value;
        }).get();
    
        $.get('/invoice_final_2.php',
            {'product': items },
            function(data) {
               //
            }
        );
    }​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pass in the session scoped the selected radio button value. My
This is the code i am using.. I want to pass the dropdown selected
I am using Jquery autocomplete in my form. After selecting the value from autocomplete,
Here is my javascript code, i want to pass current selected value of the
how do i pass the value of selected types over? I want to pass
I have an NSMutableArray of names. I want the pass the data (selected name)
I want to pass an ImageIcon instance by value as we know that by
I want to pass a string that contains few words to jQuery when click
I want to pass parameters from PHP Command Line Interface, and then read in
I have a HTML dropdown menu where I want to pass the selected values

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.