Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Zoação

Como fazer isto através de uma consulta automática?

Recommended Posts

Tenho um formulário que contém os campos abaixo...

 

</head>

<form enctype='multipart/form-data' action='process.php' method='post'>
<table cellspacing="0" style="width: 750;" bordercolor="#000066" cellpadding="0" align="center" class="auto-style2">
	<tr><td height="30" class="auto-style15" colspan="3">
		<strong>ENDEREÇO PARA ENTREGA</strong></td></tr><tr>
		<td height="30" class="auto-style19" colspan="3">
		 </td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style13" style="width: 120px">
		Nome</td>
<td height="30" width="469" class="auto-style12">
<font face="Verdana">
<input type=text name='nomecompleto' size=5 style="width: 440px"></td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style13" style="width: 120px">
		Logradouro</td>
<td height="30" width="469" class="auto-style12">
<font face="Verdana">
<input type=text name='logradouro' size=5 style="width: 441px"></td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style13" style="width: 120px">
		Número</td>
<td height="30" width="469" class="auto-style12">
<font face="Verdana"><input type=text name='numero' size=5 style="width: 211px"></td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style13" style="width: 120px">
		Bairro</td>
<td height="30" width="469" class="auto-style12">
<font face="Verdana"><input type=text name='bairro' size=5 style="width: 439px"></td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style13" style="width: 120px">
		Telefone</td>
<td height="30" width="469" class="auto-style12">
<font face="Verdana">
<input type="text" name="texto" style="width: 211px"></td></tr><tr>
		<td height="30" class="auto-style12" style="width: 3">
		 </td><td height="30" class="auto-style17" style="width: 120px">
		 </td>
<td height="30" width="469" class="auto-style12">
 </td></tr><tr><td colspan="3" height="25" width="737" ><p align="center"><font face="Verdana" size="2"><input type=submit value='Submit Form'>               <input type=reset value='Reset Form'></font></td></tr>
</table></form> <br>

 

Que preciso preencher automaticamente ao abrir a página ... estes campos segundo uma consulta à partir do usuário que está logado... (a consulta que tenho esta abaixo)

 

include("ARQUIVO_PHP_CONEXÃO_BANCO_DE_DADOS");
  $dbsa = mysql_select_db('NOME_BANCO_DE_DADOS')or die ('Erro ao selecionar banco de dados'.mysql_error());
  if(isset($_POST['send'])){
      echo'Existe o Post <br />';    
	$login = $_POST['login'];
           echo $login; 
   $sql_busca = "SELECT * FROM internautas WHERE login = '$login'";
   $exe_busca = mysql_query($sql_busca) or die (mysql_error());
   $fet_busca = mysql_fetch_assoc($exe_busca);
   $num_busca = mysql_num_rows($exe_busca);
   if ($num_busca > 0){
      $email = $fet_busca['email'];
	  //$senha = $fet_busca['senha'];
  	  $nomecompleto = $fet_busca['nomecompleto'];
  	  $logradouro = $fet_busca['logradouro'];
  	  $numero = $fet_busca['numero'];
  	  $complemento = $fet_busca['complemento'];
  	  $bairro = $fet_busca['bairro'];
  	  $telefonefixo = $fet_busca['telefonefixo'];
  	  $telefonemovel = $fet_busca['telefonemovel'];

 

Ou seja, preciso que a consulta acima seja executada automaticamente quando a página acima seja aberta... (ela irá buscar os dados através da SESSION que foi criada através de login ...

 

O campo referência é "login" (na session e banco de dados).

 

Obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.