Cita:
Iniciado por pepeverastegui
Código PHP:
<html>
<head>
<title>Prueba Combo</title>
<script type="text/javascript">
function cambio(chk)
{
if(chk.checked == true)
{
var j = document.f1.op.options.length;
document.f1.op.options[j] = new Option(chk.value);
}
else
{
var i = 0;
for(i=0; i<document.f1.op.options.length; i++)
{
if(document.f1.op.options[i].value == chk.value)
{
var sel = document.f1.op;
sel.options[i] = null;
}
}
}
}
</script>
</head>
<body>
<form name=f1>
<?php
$db = mysql_connect("localhost", "root", "verastegui");
mysql_select_db("prueba");
$res = mysql_query("select * from prueba1");
for($i=0; $i<mysql_num_rows($res); $i++)
{
mysql_data_seek($res, $i);
$row = mysql_fetch_object($res);
print "<input type='checkbox' value='$row->c1' name=chk onclick='return cambio(this)'>$row->c1<br>";
}
?>
<select name=op>
<option>-----</option>
</select>
<?php
mysql_close($db);
?>
</form>
</body>
</html>
ps alo que te entendi haber si es lo que pides y te sirve el codigo, cualquier cosa
[email protected] mi correo
Gracias! entendi todo y lo agregue a mi codigo pero no me carga los datos en el combo =oS en que estare fallando? estoy revisando pero no capto la falla