Re: Help with POSTing variable array names from a PHP script please.
| From: | Jason Wong | Date: | Sat, 15 Feb 2003 09:23:53 +0000 |
| Subject: | Re: Help with POSTing variable array names from a PHP script please. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135643@lists.php.net to get a copy of this message | ||
On Saturday 15 February 2003 17:05, Michael Eacott wrote:
> <? php
>
> # Show details of BOOKS
>
> # Performing SQL query
>
> $query = "SELECT * FROM
$books WHERE
> title LIKE '$title' LIMIT 99";
> $result = mysql_query($query) or die("Query failed");
>
> $count = 1; $bookslist = "";
> while ($rowarray = mysql_fetch_array($result, MYSQL_ASSOC))
> {
Your while loop is loop at the wrong place. Look at the HTML source of your
page ...
> $booksid = $rowarray["booksid"];
> $title = $rowarray["title"];
> print '<html>';
> print '<head>';
> print '<meta http-equiv="Content-Language"
> content="en-us">';
> print '<meta http-equiv="Content-Type" content="text/html;
> charset=windows-1252">';
[snip]
... these are all repeated for each book. Clearly that's not what you want.
> print '<p>Click box get following book retrieved.
Your loop should start here:
> <input
> type="checkbox" name="book[1][$booksid]" value ="ON"
> ><br>';
You've setup a counter ($count) so make use of it:
<input type="checkbox" name="book[$count][$booksid]" value ="ON"
>
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"Yo baby yo baby yo."
-- Eddie Murphy
*/