2010-08-20 107 views
0
<form>   
    <input class="date-pick" type="text" value="2010/08/02" name="date" /> 
    <table id="events_selection">    
     <tr>     
      <td>      
       <img src="/admin/ajax/image.php?filename=/media/immagini/danieledaniela/1.jpg&maxw=200" /> 
       <select name="1"> 
        <option value="0"> NESSUN EVENTO </option>       
        <option value="5">anelli</option>       
        <option value="8">ballo</option>       
        <option value="6">cerimonia in chiesa</option>       
        <option value="13">dettagli</option>       
        <option value="9" selected="selected"><strong>festa</strong></option>       
        <option value="4">gli sposi</option>       
        <option value="1">la sposa</option>       
        <option value="3">lancio del riso</option>       
        <option value="2">lo sposo</option>       
        <option value="11">preparazione sposa</option>       
        <option value="10">preparazione sposo</option>       
        <option value="7">ristorante</option>       
        <option value="12">varie</option>       
       </select> 
      </td> 
      <td> 
       <img src="/admin/ajax/image.php?filename=/media/immagini/danieledaniela/30.jpg&maxw=200" /> 
       <select name="31"> 
        <option value="0"> NESSUN EVENTO </option>       
        <option value="5">anelli</option>       
        <option value="8">ballo</option>       
        <option value="6">cerimonia in chiesa</option>       
        <option value="13">dettagli</option>       
        <option value="9">festa</option>       
        <option value="4">gli sposi</option> 
        <option value="1">la sposa</option>       
        <option value="3">lancio del riso</option>       
        <option value="2">lo sposo</option>       
        <option value="11">preparazione sposa</option>       
        <option value="10">preparazione sposo</option>       
        <option value="7">ristorante</option>       
        <option value="12">varie</option>       
       </select> 
      </td>     
     </tr> 
    </table> 
</form>​​​​​​​​ 

HI,在這樣的情況下(這是一個例子,有許多選擇和其它輸入)發佈這種形式將給出$ _POST這樣HTML多<select>陣列中PHP交

array { 
    date => "2010/08/09" 
    input1 => "bla" 
    input3 => "bla2" 
    //list of selection 
    1 => 2 
    2 => 4 
    3 => 5 
    //ends list of selection 
    input 4 => "bla4" 
} 

我可以直接從HTML表單將<select> s放在單獨的數組中,因爲它們表示分組數組嗎?

array { 
    date => "2010/08/09" 
    input1 => "bla" 
    input3 => "bla2" 
    //list of selection 
    array { 
     1 => 2 
     2 => 4 
     3 => 5 
    } 
    //ends list of selection 
    input 4 => "bla4" 
} 

謝謝!

回答

4

此:

<select name="selection[1]"> 
    <option>1</option> 
    <option>2</option> 
    <option>3</option> 
</select> 
<select name="selection[2]"> 
    <option>1</option> 
    <option>2</option> 
    <option>3</option> 
</select> 

將返回:

'selection' => array(1 => 1, 2 => 1) 

想這是你在找什麼? :-)

+0

是的!這是感謝 – 2010-08-21 15:48:38