<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<?php
$link=mysql_connect("localhost","root","root");
$database="negocio";
mysql_select_db($database);
$resultado=mysql_query("select fab from switches");
print "<table width=200 border=0>\n";
print "<form action=$PHP_SELF method=post>";
while($get_info=mysql_fetch_array($resultado))
{
/*
print("<td><input type=\"checkbox\" value=\"" . $get_info['fab'] . "\" name=\"check[]\"></td>\n");
*/
//echo '<input type="checkbox" name="naam" value="'.$get_info['fab'].'">'.'<br />';
?>
<input type="checkbox" value='<?= $get_info["fab"]; ?>' align="BASELINE" name="ch[]" />
<? echo $get_info['fab'];?>
<br>
<?
}
print "<input type=submit name=ok value=\"Enviar\" >";
print "</form>";
print "</table>\n";
mysql_free_result($resultado);
?>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<body >
<table width="489" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="489" height="292">
<?php
mysql_select_db("negocio",$link);
$res=mysql_query("select *from switches");
$array[]=array();
do
{
$dato=$fila['fab'];
$array[$c]=$dato;
$c++;
}while($fila=mysql_fetch_array($res));
//echo $array[1];
mysql_free_result($res);
?>
</td>
</tr>
</table>
<?
if ($ok="Enviar")
{
if (isset($_POST['ch'])
foreach ($_POST['ch'] as $value){
print $value;
}
}
?>
</body>
</html>
Alguien sabe porque me marca error el foreach , quiero mostrar los valores seleccionados del checkbox....Gracias
quiero mostrarlo en la misma pagina.