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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:31:45+00:00 2026-06-13T08:31:45+00:00

Hello guys I am using this script for my pagination: <?php if(isset($_GET[‘page’]) && $_GET[‘page’]

  • 0

Hello guys I am using this script for my pagination:

<?php
if(isset($_GET['page']) && $_GET['page'] != '') {
   $pageno = $_GET['page']; /* Sanitize Here */
} else {
   /* You can redirect user to home page */
}
?>
<?php
if(isset($pageno)) {
  if($pageno == '1') {
     ?>
<div class="container">
  <div class="examples">
    <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
    <br />
        <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
        <br />
        <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
    <br />
    <div class="pages">

       <div class="prev-blocked"></div>
              <a href="portfolio.php?page=2"><div class="next"></div></a>
<br /><br /><br />
    </div>
  </div>
<?php    
  } 
  elseif($pageno == '2') {
 ?>
 <div class="container">
 <br />
 <div class="alert alert-error">
  <b>Opps!</b> We could not find out the page you're requesting. <a href="index.php">Go back</a>
</div>
 </div>
<!--
<div class="container">
  <div class="examples">
    <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
    <br />
        <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
        <br />
        <div class="row">
      <div class="span3">
      <img id="one" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="two" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="three" src="img/example.png"/>
      </div>
          <div class="span3">
      <img id="four" src="img/example.png"/>
      </div>
    </div>
    <br />
    <div class="pages">

       <a href="portfolio.php?page=1"><div class="prev"></div></a>
              <div class="next-blocked"></div>
<br /><br /><br />
    </div>
  </div>
  -->
    <?php
  }
}
?>

Can you see the line

elseif($pageno == '2') {

It means that page .php?page=2 will display the content below

I want to make it so every page that is higher than the number 2 will display the same page.

I’ve tried these options:

elseif($pageno == '>=2') {

elseif($pageno == '>2') {

And nothing of them works, not even an error.
I doubt you can do something this way with that script but, is there any other way to do so that works?

Thanks.

  • 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-13T08:31:46+00:00Added an answer on June 13, 2026 at 8:31 am
    if ((int)$pageno >= 2) 
    

    … should do the trick.

    It actually may be written without casting to integer (or using intval function), because PHP is weakly-typed language. But I’d prefer that form to show my intention in the code more clearly. In fact, I’d change this line…

    $pageno = $_GET['page'];
    

    … to this:

    $pageno = (int)$_GET['page'];
    

    … and proceed with direct number comparisons (like $pageno === 1)

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

Sidebar

Related Questions

hello guys im using this second part of pagination script to show pagination; <?
Hello guys i have a problem streaming PDF files with php, i'm using this
Hello guys. I think it isn't possible just using PHP, but just to be
Hello Guys! I started learning python GUI development. Let's say I have this script:
Hello guys Im using advance notification manager this is the code Notification note =
Hello guys I newbie question :) - I am currently using PHP/Zend and now
Hello guys i try to get an object global/persistent over more than one php
Hello guys i have been using JavaFx scene builder to build a gui that
Hello guys here with another question, regarding sql server 2008 r2 this time about
Hello guys I have a confusing question! If I'm using WCF to create a

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.