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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:24:23+00:00 2026-06-02T19:24:23+00:00

I cannot seem to find this anywhere.. I apologize if it’s very simple. I

  • 0

I cannot seem to find this anywhere.. I apologize if it’s very simple.

I am trying to make simple drop-down box in html that displays a number of guestbook entries. I’m using php to process the database requests etc.. I’m fine with all of this. I just want to be able to have the default option on the selection box change depending on what number of entries has been selected.

Is there an easy way to do this? I have a feeling it has to do with a simple javascript call, but I’m still new to all of this.

This is the html:

<form id="displayform" action="guestbook.php" method="POST" >
Currently Displaying  <select name="display" id="display" onchange="document.getElementById('displayform').submit()">
<option value="10" > 10 </option>
<option value="25" > 25 </option>
<option value="50"> 50 </option>
<option value="ALL"> ALL </option>      
</select>   results per page
</form>
  • 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-02T19:24:24+00:00Added an answer on June 2, 2026 at 7:24 pm

    No need for javascript, this can be handled via PHP. Can even be refactored, too!

    <?php
      $options = array(10, 25, 50, 'ALL');
      $selOpt = in_array($_POST['display'], $options) ? $_POST['display'] : $options[0];
    ?>
    <form id="displayform" action="guestbook.php" method="POST">
      Currently Displaying
      <select name="display" id="display" onchange="document.getElementById('displayform').submit();">
        <?php foreach ($options as $option){ ?>
        <option value="<?=$option;?>"<?=($selOpt==$option?' select="selected"':'');?>>
          <?=$option;?>
        </option>
        <?php } ?>
      </select>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this is a very simple fix but I cannot seem to find
I cannot seem to find anyone having a problem similar to this anywhere... So
I cannot seem to find this anywhere online. I have an add button in
This may sound like a simple question, but I just cannot seem to find
This is a simple question, but I cannot seem to find a good answer
i cannot seem to find the answer to this. i uploaded code to pastebin
I cannot seem to find the answer to this I am looking for a
I am stuck on this issue and cannot seem to find a way around
I researched this question for days and cannot seem to find an option I
I have a relatively simple question that I cannot seem to find the answer

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.