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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:40:50+00:00 2026-05-26T04:40:50+00:00

I have a little problem with my PHP while loop. I am looping out

  • 0

I have a little problem with my PHP while loop. I am looping out all the available membership packages (and it’s details) from my database.

My code is like this:

       <?php
                    while($mp = mysql_fetch_assoc($s)):
                    ?>
                    <tr class="hover">
                        <td class="name" width="30%"><?php echo $mp['membershipname']; ?></td>
                        <td class="price" width="30%">$<span><?php echo $mp['ap_price']; ?></span>/<span><?php echo $mp['duration']; ?></span> days.</td>

                      <?php if($userdata['membership']>$mp['membershipid']): ?>
                          <td width="40%" class="purchase"></td>
                      <?php else: ?>
                            <td width="40%" class="purchase" >
                            <a href="#" id="upg<?php echo $mp['id']; ?>" class="click cgreen inline">Pricing</a>
                          </tr>
                      <?php endif; ?>

            <div style='display:none'>
                <div id='inline_content' style='padding:10px; background:#fff;'>

                   <div style="text-align:center;font-weight:bold">Please select your payment method:</div>

                   <div style="text-align:center">
                   <br />
                    <?php
                    if($sdata['allow_paypal'] == 1 && $mp['pp_price']>0 && $userdata['paypal']!=""): ?> 

                    <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="float:left;" >

                    <input type="submit" name="submit" class="click cblue" value="PayPal - $<?php echo $mp['pp_price']; ?>">
                    </form>

                    <?php endif; 
                    if($sdata['allow_alertpay'] == 1 && $mp['ap_price']>0 && $userdata['alertpay']!=""):
                    //Do not change any input fields, OTHER than return URL (if needed)
                    ?>

                    <form method="post" name="ap" action="https://www.alertpay.com/PayProcess.aspx" style="float:right;" >    

                    <input type="submit" name="submit" class="click cgreen" value="AlertPay - $<?php echo $mp['ap_price']; ?>" />

                    </form>

                    <?php    
                    endif; ?>
                                            </div>
            </div>                         


           </div>
                     <script>
                        $(document).ready(function(){
                            $("#upg<?php echo $mp['id']; ?>").colorbox({inline:true, width:"30%",href:"#inline_content"});
                        });
                    </script>               
                    <?php endwhile; ?>

As you can see in the above code, I am doing a while loop.

My problem is that the $mp['pp/ap_price'] inside the #inline_content is not looping. It only take the price from the first row. Although, it is looping in the table.

What’s the issue here? I tried to do another loop inside the #inline_content, but it didn’t work.

  • 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-26T04:40:50+00:00Added an answer on May 26, 2026 at 4:40 am

    HTML IDs should be unique to one DOM element.

    You have a DOM element #inline_content for every record in your database query result. Then, when you try to use Javascript to display them all, only one is displayed because they all have the same ID.

    HTML and Javascript are not aware of your PHP loop.

    Consider using a class attribute instead of an id attribute.

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

Sidebar

Related Questions

I have a little problem. I want to pass two variables from PHP to
I have this little problem, that I cannot figure out which arguments to pass
I have a little problem. Here is my example: file1.php : <?php include(file2.php); ?>
so my studies have led me to this little problem. (ive been into php
I have a nasty little problem with the pointer opperator in php (&). I
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have a little problem with a Listview. I can load it with listview
I have a little problem with a simple vbScript. The script has to run
I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,
I have a little problem where I would like to insert a svn diff

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.