0

I want to submit a form with two components: two dropdown lists. Only the first form 'School' and the submit button itself are submitted. The second form 'pool' is gone somehow.

<form method='get'> <select name='School'> <option>School Name</option> <?php while ($row = sqlsrv_fetch_object($result)){?> <option value= "<?php echo $row->ClientID ?>" > <?php echo $row->ClientName; ?></option> <?php } ?> </select> <div id='result'> <select name='pool1[]' id="pool" multiple="multiple"> <option value='de'>de</option> </select> <input type="button" value="Delete" name="submit2" onclick="removeOption();"/> </div> <div id="teacherdiv"> <select name="Teacher[]"> <option>Select Teacher First</option> </select> </div> <input type="submit" value="Add" name="submit"/> </form> 

This is the URL that I got after I pressed the submit button:

SchoolName.php?School=7&Teacher%5B%5D=Select+Teacher+First&submit=Add

The pool1 dropdown list is not in there.

5
  • my thoughts are that using get wont work for an array, you would probably need to use post Commented Jul 24, 2013 at 22:37
  • Its not named pool, it's named pool1 Commented Jul 24, 2013 at 22:38
  • 1
    I tested your form its just fine :) Commented Jul 24, 2013 at 22:40
  • @Akam Could you show me the generated URL? Thanks! Commented Jul 24, 2013 at 22:51
  • 1
    http://127.0.0.1/test.php?pool1[]=de&Teacher[]=Select+Teacher+First&submit=Add you need to select de before submit or make it selected by default Commented Jul 24, 2013 at 22:52

1 Answer 1

1

Have the first option selected by default to ensure a value is passed.

Otherwise it will not even pass an empty value.

 <select name='pool1[]' id="pool" multiple="multiple"> <option value='de' selected="selected">de</option> </select> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.