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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:35:42+00:00 2026-06-16T22:35:42+00:00

I am attempting to use modal as a simple means for users to edit

  • 0

I am attempting to use modal as a simple means for users to edit data in a MySQL db. It appears that only the first line retrieved in my SELECT statement is available to modal and I do not understand why. In other words, imagine a table with several columns, the first being a customer’s name. My goal is to be able to click a name, show a modal with a form, and then pass the results of that form to update the db using PHP. No matter which name I click, though, only values related to the first resulting line are passed.

Table ‘Item’ includes information for all of the lines that will be present in the table.

$personID is passed via GET and is the means of selecting customers of a specific employee.

The modal div is included within the PHP while clause.

The form contained in the modal passes the information to a basic PHP update script.

Thanks very much,
Mike

PHP Select Stmt:

    <?php
        $query = "SELECT * FROM item WHERE personID = $personID";
        $result = mysql_query($query);
        while($info=mysql_fetch_array($result)){
        $itemID = $info['itemID'];
    ?>  

Link (one of many; I’ve abbreviated this section):

    <div class='row-fluid'>
        <div class='span3'>
            <a href="#customerModal" data-toggle="modal"><?php echo($info['itemCustomer']); ?></a>
        </div>
    </div>  

Modal:

<div id="customerModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel"><?php echo($info['itemID']); ?></h3>
</div>
<div class="modal-body">
    <form action='pipelineEdit.php' method='post'>
        <input placeholder='Customer Name' style='width:50%' type='text' name='editValue' id='editValue'>
        <input type='hidden' value='itemCustomer' name='editField' id='editField'>
        <input type='hidden' value='<?php echo($info['itemID']); ?>' name='itemID' id='itemID'>
        <input type='hidden' value='<?php echo($personID); ?>' name='personID' id='personID'>
</div>
          <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            <button class="btn btn-primary">Save changes</button>
          </div>
          </form>
        </div>

End of PHP while comes after modal:

    <?php } ?>
  • 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-16T22:35:43+00:00Added an answer on June 16, 2026 at 10:35 pm

    You are printing multiple divs with the same ID = customerModal

    IDs have to be unique, so the link will only open the first modal printed in the loop.

    Change:

    <div id="customerModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    

    to:

    <div id="customerModal<?php echo $info['itemID']; ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    

    and:

    <a href="#customerModal" data-toggle="modal">
    

    to:

    <a href="#customerModal<?php echo $info['itemID']; ?>" data-toggle="modal">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use the remote data annotation for the first time in
First, let me start with the code I'm attempting to use: {% if modal
Attempting to use the data series from this example no longer passes the JSONLint
In attempting to use std::select1st from <functional> in a VS2008 project I found that
I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I'm attempting to use the latest master branch of ember.js and ember-data. Here's some
I'm attempting to use Backbone.js to simplify data (JSON) management and interaction with DOM.
I'm attempting to use Doctrine ORM for the first time, and I'm following the
I'm attempting to use the precompile.exe tool to generate a serialization assembly that can
I am attempting to create an MVC action method that allows users to progressively

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.