Re: reading variables?
| From: | David Dorward | Date: | Fri, 20 Jan 2006 08:18:40 +0000 |
| Subject: | Re: reading variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-228918@lists.php.net to get a copy of this message | ||
William Stokes wrote:
> For each printed document there's a check box "Delete" for
> marking that document for deletion. The document info from DB is printed
> using 'while' loop. The only problem I have is that I don't know how to
> handle/read the Delete checkbox values because the checkbox name is
> different for each file. Checkboxes are printed whit this line:"echo "<td
> colspan=\"5\"><input type=\"checkbox\"
> name=\"del_$id\">Delete</td>";"
Well, it is possible to look at all the fields which match the regular
expression /del_[0-9]+/, but you would probably be better off just doing
something like this:
<input type='checkbox' name='del[]' value='$id'
id='del_$id'>
<label for='del_$id'>Delete</label></td>
And then accessing the $_POST['del'][] array that PHP will represent that
as.
--
David Dorward <http://blog.dorward.me.uk/>
<http://dorward.me.uk/>
Home is where the ~/.bashrc is