...

View Full Version : foreach()



katherine06
02-17-2006, 02:00 AM
is there any other option rather than using foreach() function to retrieve the value of checkboxes that is selected???..
because every checkbox that i selected, new sets of users are displayed.what i want is, while loop will still print USER INFO before it prints TASK..


if (isset($_POST['cb']))
{
foreach ($_POST['cb'] as $key => $value)
{ //USER INFO
$result=mysql_query("SELECT * FROM user where user_id='$value'
order by user_id desc;") or
die("Can't perform query: ".mysql_query ());
while($row=mysql_fetch_array($result))
{
echo"<br>Firstname : ";
echo$row[firstname];
echo"&nbsp;";
echo$row[lastname];
echo"<br>Username : ";
echo$row[username];
echo"<br>";
}
//TASK
$result=mysql_query("SELECT * FROM task order by task_id asc;")
or die("Can't perform query: ".mysql_query());
while($row=mysql_fetch_array($result))
{
echo"<br>&nbsp;&nbsp; ";
echo"<input type='checkbox'> $row[task_name]";
$r=mysql_query("SELECT sub_name FROM subtask where
task_id=$row[task_id];") or
die("Can't perform query: ".mysql_query());
while($row=mysql_fetch_assoc($r))
{
echo"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo"<input type='checkbox'>&nbsp;$row[sub_name]";
}
}
};
}


somebody please please help me with this :( ....
thanks all ...:)

degsy
02-17-2006, 03:06 PM
Can you explain in a bit more detail please?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum