formeditar.php
<?php
include ("conexao.php");
$nome_alterar = $_POST ["selecao"];
$sql = "Select * from cliente where nome = '$nome_alterar'";
$resultado = mysql_query($sql) or die ("nao conectou deu erro");
while ($linha=mysql_fetch_array($resultado))
{
$codigo = $linha['id_cliente'];
$nome = $linha ['nome'];
$endereco = $linha ['endereco'];
$bairro = $linha ['bairro'];
$cep = $linha ['cep'];
$cidade = $linha ['cidade'];
$fone = $linha ['fone'];
$email = $linha ['email'];
$cpf = $linha ['cpf'];
$sexo = $linha ['sexo'];
}
?>
<html>
<head>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Lang" content="en">
<meta name="author" content="">
<meta http-equiv="Reply-to" content="@.com">
<meta name="generator" content="PhpED 5.8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="creation-date" content="01/01/2009">
<meta name="revisit-after" content="15 days">
<title>Untitled</title>
<link rel="stylesheet" type="text/css" href="my.css">
</head>
<body>
<table width="63%" border="1" align="center" cellspacing="0" cellpadding="0" >
<tr >
<td> <form name="formcliente" method="post" action="alterado.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr align="center"> <td colspan="6">Edição de Clientes</td> </tr>
<tr>
<td>Nome:</td>
<td colspan="5"><input name="nome" type="text" size="68" value=" <?php echo $nome_alterar; ?> "
<input name="codigo" type="hidden" size="68" value=" <?php echo $codigo; ?> "
</td>
</tr>
<tr>
<td>Endereco:</td>
<td colspan="5"><input name="endereco" type="text" size="68" value="<?php echo $endereco; ?>" </td>
</tr>
<tr>
<td>Bairro:</td>
<td colspan="5"><input name="bairro" type="text" size="68" value="<?php echo $bairro; ?>"</td>
</tr>
<tr>
<td>cidade:</td>
<td width="28%"> <input name="cidade" type="text" size="30" value="<?php echo $cidade; ?>" </td>
<td width="6%">cep:</td>
<td width="20%"> <input name="cep" type="text" size="15" value="<?php echo $cep; ?>" </td>
<td width="4%">Uf:</td>
<td width="16%"> <select name="uf">
<option>Pe</option>
<option>Nt</option>
</select></td>
</tr>
<tr>
<td>fone:</td>
<td width="28%"> <input name="fone" type="text" size="30" value="<?php echo $fone; ?>" </td>
<td width="6%">cpf:</td>
<td width="20%"> <input name="cpf" type="text" size="15" value="<?php echo $cpf; ?>" </td>
<tr>
<td> Email:</td>
<td colspan="5"> <input name="email" type="text" size="70"value="<?php echo $email; ?>" </td>
</tr>
<tr>
<td> Sexo:</td>
<td colspan="5" ><input name="sexo" type="radio" value="M"
<?php
if ($sexo== "M")
echo ("checked");
?>
> Masculino
<input name="sexo" type="radio" value="F">
<?php
if ($sexo== "F")
echo ("checked");
?>
Feminino </td>
</tr>
<tr>
<td colspan="6" align="center" >
<input name="atualizar" type="submit" value="atualizar">
<input name="Cancelar" type="reset" value="Cancelar"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
outro form
alterado.php
<?php
include ("conexao.php");
?>
<?php
$codigo = $_POST ["codigo"];
$nome = $_POST ["nome"];
$endereco = $_POST ["endereco"];
$bairro = $_POST ["bairro"];
$cidade = $_POST ["cidade"];
$cep = $_POST ["cep"];
$uf = $_POST ["uf"];
$fone = $_POST ["fone"];
$cpf = $_POST ["cpf"];
$email = $_POST ["email"];
$sexo = $_POST ["sexo"];
$sql ="
UPDATE cliente SET
nome='$nome',
endereco='$endereco',
bairro='$bairro',
cidade='$cidade',
cep='$cep',
uf='$uf',
fone='$fone',
cpf='$cpf',
email='$email',
sexo='$sexo'
WHERE id_cliente = '$codigo'
";
$query= mysql_query($sql) or die ("erro na gravação do banco alterado");
header ("location:index.php?link=1");
print "operação realizada com Sucesso no banco de dados no alterado";
?>
outro form selecinaaltera.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php
include ("conexao.php");
?>
<html>
<head>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Lang" content="en">
<meta name="author" content="">
<meta http-equiv="Reply-to" content="@.com">
<meta name="generator" content="PhpED 5.8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="creation-date" content="01/01/2009">
<meta name="revisit-after" content="15 days">
<title>Alterar</title>
<link rel="stylesheet" type="text/css" href="my.css">
</head>
<body>
<form name="alterar" method="post" action="index.php?link=4">
Selecione um nome:
<select name="selecao" size="1" id="selecao">
<?php
$sql = "select nome from cliente order by nome";
$resultado = mysql_query($sql) or die ("nao foi posivel conectar");
while ($registro= mysql_fetch_array($resultado))
{
?>
<option> <?php echo $registro['nome']?> </option>
<?php
}
mysql_free_result($resultado);
?>
</select>
<input name="ok alterar" type="submit" value="ok alterar">
</form>
</body>
</html>
mas vou colocar aqui os arquivos se alguem puder me ajudar ficarei grato pois estou apenas estudando venho de delphi e pretendo estudar php mas to meio perdido nao faço nem um mes de estudo aki seque os arquivos em anexo