Jump to content

Creating forms as a demo site Skyscraper Search


stbazilio
 Share

Recommended Posts

For that I'd suggest using a multiple selection field rather than a single selection field. The simplest examples would be a <select multiple> or checkboxes. You can tell PHP to submit the result as an array by appending "[]" to the field name, i.e.

<select multiple name='something[]'>
  <option value='1'>One</option>
  <option value='2'>Two</option>  
  <option value='3'>Three</option>
</select>

From the PHP side, you can retrieve it like this:

if(!empty($input->get->something)) {
  foreach($input->get->something as $value) {
    $value = (int) $value; 
    // $value contains either: 1, 2, or 3
  }
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...