Modifier un enregistrement avec PHP

bejjit -  
ThEBiShOp Messages postés 8411 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,
je ss débutant en php j aimerai faire une page qui permet de modifier un enregistrement (sous bd mysql/appache/lunix)

j ai fait le code suivent est ne fonction pas :

<?php session_start(); ?>
<html>
<head>
<title>page d´Accueil</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="mm_training.css" type="text/css" />
<style type="text/css">
<!--
.Estilo2 {font-size: 16px; font-weight: bold;}
.Estilo3 {font-size: 18px}
-->
</style>
</head>
<body bgcolor="#D3DCE6">
<form id="form3" name="form3" method="get" action="modif.php">
<?php
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
if (isset($_SESSION))
{
$HTTP_SESSION_VARS = $_SESSION;
}
}
$vr =$HTTP_GET_VARS['var'];
include ("conc.php");
$sql = mysql_query("SELECT * FROM tbline WHERE n_linea LIKE ('%$vr%')") or die (mysql_error());
mysql_data_seek($sql,0);
$row = mysql_fetch_row($sql);
$n_linea = $row[0];
$n_technique = $row[1];
$n_administrativo = $row[2];
$n_sumarin = $row[3];
$serial = $row[4];
$operador = $row[5];
$destino = $row[6];
$extremite_a = $row[7];
$extremite_b = $row[8];
mysql_close();
?>
<br>
<br>
<br>
<table width="100%">
<tr>
<td width="10%"> </td>
<td width="80%">
<table width="100%" cellpadding="0" cellspacing="0">
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>N technique</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="n_tech" id="n_tech" value="<?php echo $row[1]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>N administrative</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="n_admin" id="n_admin" value="<?php echo $row[2]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>N sumarin</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="n_sum" id="n_sum" value="<?php echo $row[3]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>Operateur</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="oper" id="oper" value="<?php echo $row[4]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>Serial</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="ser" id="ser" value="<?php echo $row[5]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>Destination</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="dest" id="dest" value="<?php echo $row[6]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>Extremite a</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="ext_a" id="ext_a" value="<?php echo $row[7]; ?>"></strong></div></td>
</tr>
<tr height="50">
<td dir="ltr" width="50%"><div align="center"><strong>Extremite b</strong></div></td>
<td dir="ltr" width="50%"><div align="left"><strong><input type="text" name="ext_b" id="ext_b" value="<?php echo $row[8]; ?>"></strong></div></td>
</tr>
</table>
</td>
<td width="10%"> </td>
</tr>
<br>
<tr>
<td width="10%"></td>
<td width="80%"><table width="100%">
<tr>
<td width="50%"></td>
<td width="50%"><input type="button" name="edit" id="edit" onClick="<?php mysql_query("UPDATE * FROM tbline SET n_linea=$n_linea $n_technique=$n_technique n_administrativo=$n_administrativo n_sumarin=$n_sumarin serial=$serial operador=$operador destino=$destino extremite_a=$extremite_a extremite_b=$extremite_b WHERE n_linea LIKE ('%$vr%')") or die (mysql_error()); ?>" value=" Modifier "></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
A voir également:

1 réponse

ThEBiShOp Messages postés 8411 Date d'inscription   Statut Contributeur Dernière intervention   1 566
 
qu'est ce qui ne fonctionne pas, il se passe quoi ??
0