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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:26:56+00:00 2026-06-05T09:26:56+00:00

I have a POST form in PHP that I’m converting to GET . The

  • 0

I have a POST form in PHP that I’m converting to GET.

The form works and gives me the first page of results without any problems.

But how do I link to the second page? I assume I have to replicate all the GET parameters into the “Next Page” link plus the page number (which the script already handles), but how would I do that?

CLARIFICATION: How do I get all the GET variables from a form onto a link in the page?

  • 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-05T09:26:57+00:00Added an answer on June 5, 2026 at 9:26 am

    simpliest way is too to do something like:

    $get = preg_replace("/page=\d+/i", "", $_SERVER['QUERY_STRING']);
    
    $link = "somepage.php?".$get."&page=".($_GET['page']+1);
    
    echo "<a href='".$link."'>Next Page</a>";
    

    That will simply take the get string, remove the page then add the page back in as +1. Please note this would be insecure as people could pass anything in the query string. A better option would be to build the the URL explicitly by checking for each expected $_GET key=>value pair, validating it, then adding it to a link variable. That way any additional bits in the query string wont be echo’d to the page.

    EDIT:

    Ok so heres a very quick example.

    $category = (int)$_GET['cat'];
    $keyword = trim($_GET['keyword']);
    $keyword = filter_var($keyword, FILTER_SANITIZE_STRING);
    
    
    $nextlink  = "somepage.php?";
    $nextlink .= http_build_query(array(
       "cat" => $category,
       "keyword" => $keyword,
       "page" => $page+1
    ));
    

    So basically you get the GET var’s you want, validate them, then just use http_build_query and an associative array to build your query string for the link. The security i put in their is very basic, but typecasting numbers and limiting the amount of crud you can stick into a string is a place to start

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

Sidebar

Related Questions

I have a PHP page that accepts input from a form post, but instead
So I have a form on PHP/HTML page. User submitss it to that same
I have a PHP form that I've set up with a POST method. When
I have a simple html form and some php that input the POST variables
I have a php page that generates a form. The action attribute of the
I have a post html form, and the action is index.php, which is the
I have this HTML: <form action='uploadhandle.php' method='POST' enctype=multipart/form-data> <input type='file' class='fileinput' id='photo1' name='photo1'> <input
I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I have a form on which I POST the data with PHP. When the
In a php-script i have a form, method is post, action-attribute is empty, which

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.