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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:09:17+00:00 2026-06-14T18:09:17+00:00

HTML&PHP I list ticket info; <table> <?php while($values = mysql_fetch_array($ticketInfo)){ echo ‘<tr>’; echo ‘<td

  • 0

HTML&PHP

I list ticket info;

  <table>      
  <?php
  while($values = mysql_fetch_array($ticketInfo)){ 
    echo '<tr>';
    echo '<td id="ticketPrice">'. $values['ticket_price'] .'</td>';
    echo '<td id="myBonus">'. $values['bonus']*5 .'</td>';
    echo '<td><input type="checkbox" name="use_bonus" onclick="useMyBonus();"  id="myBonusId" /></td>';
    echo '</tr>';
  }      
  ?>
  </table>

When user click checkbox process a jquery script for calculate discount with use bonus and write returning data to ticketPrice ID. But there is multiple checkbox and if user click another checkbox script calculate again but I don’t this. How can I process it only once?

My jquery Code;

  function useMyBonus(){
    myBonus         = parseInt($("#myBonus").text());
    ticketPrice     = parseInt($("#ticketPrice").text());
    checked         = $("#myBonusId").is(':checked');



    if(checked == true){
        $("#ticketPrice").text(ticketPrice-(myBonus/2));

    }else{
        $("#ticketPrice").text(ticketPrice+(myBonus/2));

    }
} 
  • 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-14T18:09:18+00:00Added an answer on June 14, 2026 at 6:09 pm

    This would ensure your checkboxes are unique –

    <table>      
    <?php
    $i=0;
          while($values = mysql_fetch_array($ticketInfo)){ 
            echo '<tr>';
            echo '<td id="ticketPrice">'. $values['ticket_price'] .'</td>';
            echo '<td>'. $values['bonus']*5 .'</td>';
            echo '<td><input type="checkbox" name="use_bonus" value="' .$i++ . "_" . $values['ticket_price']  . '"  /></td>';
            echo '</tr>';
          }      
          ?>
          </table>
    

    This would loop through all the checkboxes and continue with calculation

     <script type="text/javascript">
        function useMyBonus()
        {
            var myBonus=0;
    
    
            checkboxes = document.getElementsByName('use_bonus');
    
            for(var i in checkboxes)
            {
                if(checkboxes[i].checked)
    
                {
                              var n=str.split("_");
                              //now your ticket price would be n[1], use n[1] for your bonus calculation 
                            //calculate myBonus         
                }           
    
    
            }
        }
    
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While writing code in a file that would comprise of PHP, HTML, CSS &
lets say i have two pages links.html & contents.php ... first page contains only
HTML <p href=products.php?ref=fijo&tipo=7001ad class=principal>Fijas</p> <div class=menu_body id=fijo> <a href=products.php?ref=fijo&tipo=7001ad>Normal (7001AD)</a> <a href=products.php?ref=fijo&tipo=7001md>Aislada (7001MD)</a> <a
Given this html: <div class=nation> <a href=library.php?type=nation&amp;id=America> <div class=nation-image> <img src=nations/America.png alt=snip /> </div>
I would like to change: http://example.com/index.php?p=blog&pid=2&lid=1&l=en into just http:// example.com/en/blog.html or just http:// example.com/blog.html
I want to convert these URLs to SEO friendly URLs: index.php?t=1&s=1&offset=50&hits=50 ---> index-t-1-s-1-offset-50-hits-50.html index.php?t=1&s=1
Here's what I'm trying to achieve: Before: www.example.com/index.php?page=about&pg=5 After: www.example.com/about.html?pg=5 The URL must specifically
I have list: <td ><a href=#><?php echo $meniu['lovos']; ?></a> <ul> <?php $result = mysql_query(SELECT
I'm a newbie in php & i'm trying to load dropdown list from a
I'm learning Php & Mysql. I've a database(practice) with 2 table. One is Category

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.