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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:44:49+00:00 2026-05-13T23:44:49+00:00

I have recently used a PHP pagination tutorial, Pagination – what it is and

  • 0

I have recently used a PHP pagination tutorial, Pagination – what it is and how to do it, to display record information from a MySQL database. The problem is that the page only sends out the information sent in the latest form, and I am not quite sure how to fix the problem.

The code for the form output is shown below.

$musicitems = getmusicitems($pagenumber,$prevpage,$lastpage,$nextpage);
$count = ($musicitems==NULL) ? 0 : mysql_num_rows($musicitems);
for ($i=0;$i<$count;$i++)
{
    $records = mysql_fetch_assoc($musicitems);
    print'
        <label for="deleteMusicItem'.$records['m_id'].'" id="deleteMusicItemLabel'.$records['m_id'].'">Delete Music Record:</label>
        <input type="checkbox" name="deleteMusicItem"  id ="deleteMusicItem'.$records['m_id'].'" value="delete" />
        <br/>
        <label for="artistname'.$records['m_id'].'" id="artistLabel'.$records['m_id'].'">Artist Name:</label>
        <input type="text" size="30" name="artistname" class="artistname1" id ="artistname'.$records['m_id'].'" value="'.$records['artistname'].'" />
        <br/>
        <label for="recordname'.$records['m_id'].'" id="recordnameLabel'.$records['m_id'].'">Record Name:</label>
        <input type="text" size="30" name="recordname" class="recordname1" id ="recordname'.$records['m_id'].'" value="'.$records['recordname'].'"/>
        <br/>
        <label for="recordtype'.$records['m_id'].'" id="recordtypeLabel'.$records['m_id'].'">Record type:</label>
        <input type="text" size="20" name="recordtype" class="recordtype1" id ="recordtype'.$records['m_id'].'" value="'.$records['recordtype'].'"/>
        <br/>
        <label for="format'.$records['m_id'].'" id="formatLabel'.$records['m_id'].'">Format:</label>
        <input type="text" size="20" name="format" class="format1" id ="format'.$records['m_id'].'" value="'.$records['format'].'"/>
        <br/>
        <label for="price'.$records['m_id'].'" id="priceLabel'.$records['m_id'].'">Price:</label>
        <input type="text" size="10" name="price" class="price1" id ="price'.$records['m_id'].'" value="'.$records['price'].'"/>
        <br/><br/>
    ';
    $musicfiles=getmusicfiles($records['m_id']);
    for($j=0; $j<2; $j++)
    {
        $mus=mysql_fetch_assoc($musicfiles);
        if(file_exists($mus['musicpath']))
        {
            echo '<a href="'.$mus['musicpath'].'">'.$mus['musicname'].'</a><br/>';
        }
        else
        {
            echo '<label for="musicFile'.$records['m_id'].'" id="musicFileLabel'.$records['m_id'].'">Music:</label> <input type="file" size="40" name="musicFile1" id="musicFile'.$records['m_id'].'"/><br/>';
        }
    }
    $pictures=getpictures($records['m_id']);
    for($j=0;$j<2;$j++)
    {
        $pics=mysql_fetch_assoc($pictures);
        if(file_exists($pics['picturepath']))
        {
            echo '<img src="'.$pics['picturepath'].'" width="150" height="150"><br/>';
        }
        else
        {
            echo '<label for="pictureFile'.$records['m_id'].'" id="pictureFileLabel'.$records['m_id'].'">Picture:</label><input type="file" size="40" name="pictureFile1" id="pictureFile'.$records['m_id'].'"/><br/>';
        }
    }
}

echo'<input type="submit" value="Submit" name="modfiymusicitem" id="modfiymusicitem" /> ';
if ($pagenumber == 1) {
    echo " FIRST PREV ";
}
else {
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenumber=1'>FIRST</a> ";
    $prevpage = $pagenumber-1;
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenumber=$prevpage'>PREV</a> ";
}
echo "(Page $pagenumber of $lastpage)";
if ($pagenumber == $lastpage) {
    echo " NEXT LAST ";
}
else {
    $nextpage = $pagenumber+1;
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenumber=$nextpage'>NEXT</a> ";
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenumber=$lastpage'>LAST</a> ";
}
  • 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-13T23:44:50+00:00Added an answer on May 13, 2026 at 11:44 pm

    You have to pass the form data to the next page manually. This, most important part, is always forgotten by tutorial writers.

    You have to pass to other pages, not only the page number, but the whole form data.
    I hope your form uses the GET method, as it should be, so, you have your data either in the $_SERVER['QUERY_STRING'] as a string or the $_GET array. So, you can either do regexp pagenumber in the QUERY_STRING, or assemble another QUERY_STRING from the $_GET array, like this:

    $_GET['pagenumber']=$nextpage;
    $query_string=http_build_query($_GET);
    echo " <a href='{$_SERVER['PHP_SELF']}?$query_string'>NEXT</a> "; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to select data from mysql database by joining tables using PHP and
I recently switched from MySQL to PostgreSQL. I have one problem left however. Previously,
I have recently used an icon file received from our marketing team. The icon
I have recently had a linux server compromised from bots uploading .php scripts and
I have developed an application using php, mysql and xajax. I always used to
I've just recently updated my PHP to a newer version and have discovered that
I've recently started doing some JSF work - before that I've always used PHP
It's been a while that i have used the php mail function in the
I have recently started a project in Ruby on Rails. I used to do
Recently, I have worked in a project were TDD (Test Driven Development) was used.

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.