Hi all i got a form with many checkboxes and i want to pass checkbox varaibles to a new page using post method but the problem is that each time the first variable get pasted .Beleow u see part of php code that recives the passed variables. When i run this script by selecting 3 check boxes which has values :1 first check box, 2 second checkbox and 3 3th checbox. i get this
select filename,title from wimpy where id=1
instead of
select filename,title from wimpy where id=1 OR id=2 OR id=3
I be happy if an expert help me fix this problem and be able to pass all values of check box to second page and be able to buil query such :
select filename,title from wimpy where id=1 OR id=2 OR id=3
Thanks
part of check box form code:
playlist.php code
select filename,title from wimpy where id=1
instead of
select filename,title from wimpy where id=1 OR id=2 OR id=3
I be happy if an expert help me fix this problem and be able to pass all values of check box to second page and be able to buil query such :
select filename,title from wimpy where id=1 OR id=2 OR id=3
Thanks
part of check box form code:
Code:
<form method="POST" action="./playlist.php" name="mp3Play">
...
...
...
Code:
<?php
//echo $_POST['id'];
$user = "root";
$pw = "";
$db = "mp3sversion5";
$mysql_access = mysql_connect("localhost", $user, $pw);
mysql_select_db($db, $mysql_access);
[B]if (isset($_POST['Id'])) {
$fragments = explode(',',$_POST['Id']);
$loopCount = sizeof($fragments);
for ($loop = 0; $loop < $loopCount; $loop++) {
if ($where != '') $where .= ' OR';
$where .= ' id='.$fragments[$loop].' ';
}[/B]}
$query = "select filename,title from wimpy where $where";
[B]echo $query;[/B]
[B]$result = mysql_query($query);[/B]