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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:13:44+00:00 2026-06-07T17:13:44+00:00

I wonder whether someone may be able to help me please. I’m using the

  • 0

I wonder whether someone may be able to help me please.

I’m using the code below to create a table which lists location records for the current user.

<form name="locationsconsole" id="locationsconsole" method="post" action="locationsaction.php">
            <table width="865">
                    <tr>
                        <th width="22"></th>
                        <th width="236"><div align="left">Location Name</div></th>
                        <th width="244"><div align="left">Location Address</div></th>
                        <th width="71"></th>                                
                    </tr>   

                    <?php


                    $query = "SELECT  l.*, COUNT(f.locationid) totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '$idnum' GROUP BY l.locationname";
                    $result = mysql_query($query) or die('error');

                    while($obj=mysql_fetch_object($result))
                    {

                    ?>

                    <tr>
                        <td><input type="hidden" name="lid" value="<?php echo $obj->locationid;?>"/></td>
                        <td><?php echo $obj->locationname;?></td>
                    <td><?php echo $obj->returnedaddress;?></td>
                        <td><input name="type" type="submit" value="View Details"/></td>
                    </tr>
                                <?php
                                    }   

                                ?>


              </table>
      </form>

You’ll see that on each row there is a button which takes the user to another page via locationsaction.php which is listed below.

<?php 
session_start();
$_SESSION['lid'] = $_POST['lid'];
if (isset($_POST['type'])) {
    $urls = array(
        'View Details' => 'viewlocation.php'
    );
    $url = $urls[$_POST['type']];
    header("Location: " . $url);
}
?>

There are currently 3 location records in the table which is correct, and when the button is clicked the user is taken to the correct screen.

However, the problem I’m having is that no matter which row I click the button on, the record retrieved is always related to the last location record.

I’ve been trying to sort this for quite some time now, and I’ve just not been able to find a solution, despite many page re-writes.

I just wondered whether someone could take a look at this please and let me know where I’m gong wrong.

  • 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-07T17:13:47+00:00Added an answer on June 7, 2026 at 5:13 pm

    After considerable time spent researching this on the Internet, I found the solution here. I was then able to edit this to suit my needs to the following script:

    <?php
    
                        $query = "SELECT  l.*, COUNT(f.locationid) totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '$idnum' GROUP BY l.locationname";
                        $result = mysql_query($query) or die('error');
                        $row = mysql_fetch_assoc($result);              
                        extract($row); 
    
                        /* Display Users in a table */ 
                        echo "<table cellspacing='5' border='0' cellpadding='0' width=95%>"; 
                        echo "<tr><td colspan='0' style='text-align: Left'></td></tr>\n"; 
                        echo "<tr><td style='font-weight: bold; 
                            font-size: 1.0em'>Location</td><td style='font-weight: bold; 
                            font-size: 1.0em'>Address</td><td style='font-weight: bold;  
                            font-size: 1.0em'>Finds Made</td></tr>\n";
                        mysql_data_seek($result, 0);
    
                        while($row = mysql_fetch_array($result))
                        {
    
    
                        /* display row for each user */ 
                            echo "<tr>\n"; 
                            $theID = $row['locationid']; 
                            echo " <td>{$row['locationname']}</td>\n"; 
                            echo " <td>{$row['returnedaddress']}</td>\n"; 
                            echo " <td>{$row['totalfinds']}</td>\n"; 
                            echo " <td><form action= locationsaction.php  method= 'post'><input type='hidden' name='lid' value=$theID />
                                        <input type= 'submit' name= 'type' value= 'View/Amend Location Details'/><input type= 'submit' name= 'type' value= 'Add/View Find Images'/><input type= 'submit' name= 'type' value= 'View Location Finds'/><input type= 'submit' name= 'type' value= 'View Location Finds'/></form></td>\n"; 
                            echo "</tr>\n"; 
    
    
                        }
                        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. The code below
I wonder whether someone may be able to help me please. The code below
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using Aurigma
I wonder whether someone may be able to help me please. Using some excellent
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using this
I wonder whether someone may be able to help me please. I am using
I wonder whether someone may be able to help me please. I'm using the

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.