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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:59:56+00:00 2026-05-16T10:59:56+00:00

The user sees a form with many controls, including a list box. He selects

  • 0

The user sees a form with many controls, including a list box. He selects a single item in the list box and presses “submit”.

In PHP I access $_POST[] and want to display the list box as read-only or disabled with his his selected item also selected. It should be read-only or disabled because I am showing him what he submitted and I don’t want him changing it.

Can someone please give a very simple code example? (it has to work in MS IE (not my choice))


Edit for clarification:

There are two forms – a submission form in HTMl and a processing & acknowledgement form in PGP.

The first form offers a choice in many controls, the second verifies the input and, if valid, displays the input form again with a confirmation message. On this second form all fields must be static.

I have a problem only with a listbox (size >1, not combobox). I want to display ll of the initial choices but the user should not be allowed to change the selection, i.e, display all items, with one selected as either readonly or disabled.

  • 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-16T10:59:57+00:00Added an answer on May 16, 2026 at 10:59 am
    <form action="" method='post'>
    <?php 
    $disabled = isset($_POST['list'])?"disabled='disabled'":"";
    ?>
    <select name='list' <?php echo $disabled;?> >
      <?php $selected = isset($_POST['list'])&&$_POST['list']=="1"?"selected='selected'":"";?>
      <option value="1" <?php echo $selected;?>>option1</option>
      <?php $selected = isset($_POST['list'])&&$_POST['list']=="2"?"selected='selected'":"";?>
      <option value="2" <?php echo $selected;?>>option2</option>
    </select>
    
    <input type="submit" value="Submit" />
    </form>
    

    i know i know… it looks horrible, there are cleaner ways to do it. but it works as an example

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

Sidebar

Related Questions

User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am
User kokos answered the wonderful Hidden Features of C# question by mentioning the using
User-Defined Functions & Collating Sequences Full support for user-defined functions and collating sequences means
User A logs into a ticket management system to edit content on SomePage.aspx User
User click on a link button and it will direct them to a url
If user input is inserted without modification into an SQL query, then the application
What user context do SharePoint timer jobs run under? The farm account? I'm going
1) user A goes to the site, creates an account, and logs in 2)
StackOverflow user jolson had a very nice piece of code that exemplifies how one
We user JIRA for bug tracking and release management and we have started using

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.