|
Posted by zek2005 on 10/14/69 11:35
Hi!!!
I need to retrieve the information of a database in 2 steps. First,
depending on the number of a branch, I have to show in a combo the
commercial campaigns available for that branch. Then when the user
select one campaign I need to chow the customers of that campaign.
I have two errors
(http://www.historiadelpais.com.ar/bp/acciones_vigentes.php).
First: As I do not have the second variable when I load the page I
receive the first error.
Second: When I enter a branch (example: 17 or 20), the combo box works
but when I try to retrieve the customers I have another error.
Thak you for your help!!!!
Zek
This is the code:
<html>
<head>
<title>Clientes</title>
</head>
<body>
<p align="center"><u><b>Acciones Vigentes</b></u></p>
<form method="POST" action="<?=$PHP_SELF?>">
<p align="center"><b><font face="Tahoma"
size="2">Sucursal
</font></b><input type="text" size="6" name
="suc">
<input type="submit" value="Ingresar"></p>
</form>
<?PHP
$dbase = mysql_connect("localhost", user , pass);
mysql_select_db(historia,$dbase);
$respuesta = mysql_query("SELECT distinct codigo, descripcion
FROM `det_acciones`
INNER JOIN acciones
ON acciones.accion = det_acciones.codigo
WHERE oficial_id =$suc", $dbase);
?>
<form method="POST" action="<?=$PHP_SELF?>">
<select name="campania">
<?PHP
printf("<option selected value=\"\"> Seleccionar Acción
</option>");
while($row = mysql_fetch_array($respuesta))
{
printf("<option value=\"%s\"> %s
</option>",$row["codigo"],$row["descripcion"]);
}
?>
</select>
<input type="submit" value="Ver clientes">
</form>
<?PHP
$response = mysql_query("SELECT nombre
FROM `acciones`
WHERE oficial_id =$suc and accion=$campania", $dbase);
while($row = mysql_fetch_array($response))
{
echo($row[nombre]);
}
?>
</body>
</html>
Navigation:
[Reply to this message]
|