I got 1 php page that search one client in the DB. But when i enter the page, the text box dont happear clean... they happear with this -----> <br /> <b>Notice</b>: Undefined variable: nome in <b>C:\wamp\www\Secretel\pesquisar_pacientes.php</b> on line <b>10</b><br />
Im going to show my code, hopping u can help me...
Code: Select all
<?php require_once("includes/session.php");?>
<?php require_once("includes/connection.php");?>
<?php require_once("includes/functions.php");?>
<title>Pesquisar Clientes</title>
<h1><center> Pesquisar Clientes </center></h1><br/>
<!--------PESQUISAR CLIENTES--------->
<form action="pesquisar_pacientes.php" method="post">
<table>
<tr><td>Nome:</td>
<td><input type="text" name="nome" maxlength="30" value="<?php echo htmlentities($nome); ?>"/></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Pesquisar" /></td></tr>
</table>
</form>
<form action="pesquisar_pacientes.php" method="post">
<table>
<tr><td>Telefone:</td>
<td><input type="text" name="telefone" maxlength="30" value="<?php echo htmlentities($telefone); ?>"/></td></tr>
<tr><td colspan="2"><input type="submit" name="tele" value="Pesquisar" /></td></tr>
</table>
</form>
<!----------------PESQUISA POR NOME---------->
<?php if(isset($_POST['submit'])){
$nome = strip_tags($_POST['nome']);
$exc = "SHOW TABLES"; /*VARIÁVEL RENOMEADA*/
$query = mysql_query("SELECT * FROM pacientes WHERE nome = '".mysql_real_escape_string($nome)."'");
echo "<center><font face=Verdana size=2><b>Tabelas da base de dados</b></font></center><br>";
echo "<table>";
while($dados = mysql_fetch_array($query)){
$descreva = mysql_query("SELECT * FROM pacientes WHERE id='". $dados[0] ."'");
}
while($atributos = mysql_fetch_array($descreva)){
echo "<tr><td><font face=Verdana size=1>$atributos[0]</td><td><font face=Verdana size=1>| $atributos[1]</td><td><font face=Verdana size=1>| $atributos[2]</td><td><font face=Verdana size=1>| $atributos[3]</td><td><font face=Verdana size=1>| $atributos[4]</td></tr>"; }
echo "</table>";
}[i]else{$nome = '';}[/i]
?>
<!----------------PESQUISA POR TELEFONE---------->
<?php if(isset($_POST['tele'])){
$telefone = strip_tags($_POST['telefone']);
$exc = "SHOW TABLES"; /*VARIÁVEL RENOMEADA*/
$query = mysql_query("SELECT * FROM pacientes WHERE telefone = ($telefone)");
echo "<center><font face=Verdana size=2><b>Tabelas da base de dados</b></font></center><br>";
echo "<table>";
while($dados = mysql_fetch_array($query)){
$descreva = mysql_query("SELECT * FROM pacientes WHERE id='". $dados[0] ."'");
}
while($atributos = mysql_fetch_array($descreva)){
echo "<tr><td><font face=Verdana size=1>$atributos[0]</td><td><font face=Verdana size=1>| $atributos[1]</td><td><font face=Verdana size=1>| $atributos[2]</td><td><font face=Verdana size=1>| $atributos[3]</td><td><font face=Verdana size=1>| $atributos[4]</td></tr>"; }
echo "</table>";
}[i]else{$telefone = '';}[/i]
?>Can u tell me how can i put that texts boxes clean??