buenas necesito agregarle un name a un select,pero no puedo hacerlo dentro de un while:
Código PHP:
Ver original<?php
include("conecta.php");
global $db_selected;
global $db;
//$usertable = 'prueba1';
$result = mysql_query("SELECT objetos FROM prueba1", $db);
echo "<select > \n"; //name= "objetos[]"
echo "<option value="$row[0]"></option> ";
}
echo "</select> \n";
$result1 = mysql_query("SELECT lugares FROM prueba2", $db);
echo "<select > \n"; //name="lugares[]"
echo "<option>$row[0]</option> ";
}
echo "</select> \n";
?>
esto funciona, pero al tomarlo con el siguiente codigo no lo ve, agradezco respuesta.
Código PHP:
Ver original<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> prueba3 </title>
</head>
<body>
<p align=center>Asignacion</p>
<br><br>
<form method="post" action="adjudicar3.php" name= "formulario" >
<p> objetos lugares </p>
<?php
include("conecta.php");
global $db_selected;
global $db;
//echo "<select > \n"; //name= "objetos[]"
function obj($result){
$result = mysql_query("SELECT objetos FROM prueba1", $db); {
echo "<option>$row[0]</option> ";
}
}
//echo "</select> \n";
?><select name="objetos" value="<?php obj($result); ?>"></select>
<?php
$result1 = mysql_query("SELECT lugares FROM prueba2", $db);
echo "<select > \n"; //name="lugares[]"
echo "<option>$row[0]</option> ";
}
echo "</select> \n";
?>
<input type="submit" value="insertar"> <br><br>
</form>
<form method="post" action="buscar3.php" name= "formulariobuscar" >
Buscar:<input type="text" name="busca"> <br><br>
<input type="submit" value="buscar"> <br><br>
</form>
<a href = "http://www.fxb4.com/juanmegasoft/0pf/lugares/formulariolugares.php">modificar lugares y capacidad</a>
<br><br>
</body>
</html>