Re: Handling checkboxs (MySQL+PHP)
| From: | George Nicolae | Date: | Sun, 30 Dec 2001 07:53:30 +0000 |
| Subject: | Re: Handling checkboxs (MySQL+PHP) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79059@lists.php.net to get a copy of this message | ||
//you must make some change :
echo "<td><input type=\"checkbox\" name=\"frm_".$pid."\"
value =
\"$pid\"></td>";
^^^^^^^^^^
//you must find the max pid from database with query
//"select pid from catalog order by pid desc limit 1"
for ($i=0;$i<max_pid;$i++)
{
$v="pid_".$i;
if(isset($$v)) ... make what you want to do .....;
}
--
Best regards,
George Nicolae
IT Manager
___________________
X-Playin - Professional Web Design
www.x-playin.f2s.com
"David Jackson" <david.j.jackson@pickledbeans.com> wrote in message
news:2211.63.165.192.203.1009680023.cqhost@webmail.cqhost.com...
> ALL --
> The snipet below is used to generate the table containing
> product info (product_id(pid), title, amount) and checkboxs.
> When submit is clicked the data is passed to "instert into"
> sql statement.
>
> My question is how do I process checkbox when multi boxes have
> been check. I keep thinking a array is created by check boxes?
> -- David
>
> -------- order_form.php --------
> // Define table
> echo "<br><table bgcolor=\"gray\" border=\"1\" >";
> // Generate book listing
> $result = mysql_query("SELECT pid,date,title,subtitle,author,amount FROM
> catalog ") or die("Dis ain't right !!");
> while (
>
list($pid,$date,$title,$subtitle,$author,$amount)=mysql_fetch_row($result)){
> echo "<tr>\n";
> echo "<td><input type=\"checkbox\" name=\"frm_pid\" value =
> \"$pid\"
> ></td>";
> echo "<td>$title</td>";
> echo "<td>Price: $amount</td>";
> echo "</tr>\n";
> }
> echo "</table>";
>
>