How to make selected option unselectable

I`m trying to create a form with options. What i want to do is make options unselectable for the next user when a user selects it. Is there a simple way i can achieve this?

  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value ="opel">Opel</option>
  <option value ="audi">Audi</option>

[font=verdana]Assuming you got that example from, you just need to read a bit further down the page … use the ‘disabled’ attribute to disable an option, ie prevent it from being selected.


Moved from PHP to XHTML because the question as you’ve asked it isn’t anything to do with PHP.

You can’t make options unselectable using just HTML. You need a server side language such as PHP to do that (the OP posted in the correct forum to start with).

What you would need to do is to capture the selection made by the first visitor and use that to determine which option to make unselectable for subsequent visitors. For example if the $sel variable contains the value of the option you want disabled you would use:

  <option value ="volvo"<?php if ($sel == 'volvo') echo ' disabled'; ?>>Volvo</option> 
  <option value ="saab"<?php if ($sel == 'saab') echo ' disabled'; ?>>Saab</option> 
  <option value ="opel"<?php if ($sel == 'opel') echo ' disabled'; ?>>Opel</option> 
  <option value ="audi"<?php if ($sel == 'audi') echo ' disabled'; ?>>Audi</option> 

Note that this would only apply to the next person to open the form after the first person submitted it - it would not apply to the people who open the form while the first person is still filling it out.