only checked checkboxes are submitted therefore you have to number
the form fields if you want to keep the relationship between the arrays
- this should be easy enough if the form is generated by your code.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
----- Original Message -----
From: Mike <[EMAIL PROTECTED]>
To: php mailinglist <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 5:59 PM
Subject: [PHP] A small problem with input feilds.


> Hello everyone,
> I have the following html code that is generated via a script:
>
> <table>
>  <form action="/new/mp3/stuff/testsearch.php" method="post" target="">
>
> <tr><td><b>Artist</b></td><td><b>Title</b></td><td><b>File
> Size</b></td><td>Check</td></tr>
>  <tr>
>   <td width=295 valign=top>
>    <p><b> Dj Ummet</b></p>
>   </td>
>   <td width=195 valign=top>
>    <p><b>Pump This Party (extended Mix)</b>
>   </td>
>    <td width = "195" valign = "top">
>    <b>About 4.5 megabytes</b></p>
>   </td>
>   <td valign=top><input type=checkbox name=file[]
> value=%28Dj+Ummet%29+-+Pump+This+Party+%28Extended+Mix%29.mp3>
>    <input type=hidden name=filenumber[] value=3437>
>   </td>
>  </tr>
> </tr>
>  <tr>
>   <td width=295 valign=top>
>    <p><b> Metalica</b></p>
>   </td>
>   <td width=195 valign=top>
>    <p><b>Enter Sandman</b>
>   </td>
>    <td width = "195" valign = "top">
>    <b>About 4.43 megabytes</b></p>
>   </td>
>   <td valign=top><input type=checkbox name=file[]
> value=%28Metalica%29+-+Enter+Sandman.mp3>
>    <input type=hidden name=filenumber[] value=986>
>   </td>
>  </tr>
> </tr>
>  <tr>
>   <td width=295 valign=top>
>    <p><b> Metalica</b></p>
>   </td>
>   <td width=195 valign=top>
>    <p><b>The Memory Remains</b>
>   </td>
>    <td width = "195" valign = "top">
>    <b>About 4.24 megabytes</b></p>
>   </td>
>   <td valign=top><input type=checkbox name=file[]
> value=%28Metalica%29+-+The+Memory+Remains.mp3>
>    <input type=hidden name=filenumber[] value=2331>
>   </td>
>  </tr>
> </tr>
>  <tr>
>   <td width=295 valign=top>
>    <p><b> Metallica</b></p>
>   </td>
>   <td width=195 valign=top>
>    <p><b>Battery</b>
>   </td>
>    <td width = "195" valign = "top">
>    <b>About 4.77 megabytes</b></p>
>   </td>
>   <td valign=top><input type=checkbox name=file[]
> value=%28Metallica%29+-+Battery.mp3>
>    <input type=hidden name=filenumber[] value=2136>
>   </td>
>  </tr>
> </tr>
> </table>
> <input type="submit" name="submit" value="submit">
> </form>
>
> the problem is this:
> Array
> (
>     [filenumber] => Array
>         (
>             [0] => 3437
>             [1] => 986
>             [2] => 2331
>             [3] => 2136
>         )
>
>     [file] => Array
>         (
>             [0] => %28Metalica%29+-+Enter+Sandman.mp3
>             [1] => %28Metallica%29+-+Battery.mp3
>         )
>
> when I submit the form, I get the whole array of filenumber but only the
> selected files. Is there a way that I could limit it so that I get only
the
> selected filenumbers and files, or should I re-think the way the script
> works?
>
> Thank you,
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to