Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/03/2012, 00:18
rimox
 
Fecha de Ingreso: marzo-2012
Mensajes: 17
Antigüedad: 12 años, 1 mes
Puntos: 0
Mensaje Modificar tablas desde formulario php

bueno muchachos otro problema espeor y me puedan ayudar.

mis archivos son los siguientes:

consultaequipo.php
Código PHP:
<html>
<
head>
   <
title>Modifica Equipo</title>
</
head>
<
body>
<
h1>Modificar equipo</h1>
<
form action="buscaequipo.php" method="post">
Equipo:
 <
input type="text" name="nombre" size="20" maxlength="30">
 <
input type="submit" name="accion" value="Buscar">
</
FORM>
</
body>
</
html
buscaequipo.php
Código PHP:
<html>
<body>
<?php
   
include("conec.php");
   
$link=Conectarse();
   
$Sql="select * from ligascenso where id like '%."$_POST["nombre"]."%'";
   
$result=mysql_query($Sql,$link);
?>
<table border="1" cellspacing="1" cellpadding="1">
<tr>
<td>&nbsp;ID</td>
<td>&nbsp;EQUIPO&nbsp;</td>
<td>&nbsp;GF&nbsp;</td>
<td>&nbsp;GC&nbsp;</td>
<td>&nbsp;PUNTOS&nbsp;</td>
</tr>
<form name="form1" method="post" action="modificaequipo.php">
<?php    
   
while($row mysql_fetch_array($result))
   {
printf("<tr><td><INPUT TYPE='text' NAME='id' SIZE='20' MAXLENGTH='30' value='id'></td><td>&nbsp;<INPUT TYPE='text' NAME='nombre' SIZE='20' MAXLENGTH='30' value='id_equipo'>&nbsp;</td><td>&nbsp;<INPUT TYPE='text' NAME='favor' SIZE='20' MAXLENGTH='30' value='gf'>&nbsp;</td><td>&nbsp;<INPUT TYPE='text' NAME='contra' SIZE='20' MAXLENGTH='30' value='gc'>&nbsp;</td><td>&nbsp;<INPUT TYPE='text' NAME='puntos' SIZE='20' MAXLENGTH='30' value='ptos'>&nbsp;</td></tr>"$row["id"],$row["id_equipo"],$row["gf"],$row["gc"],$row["ptos"]);
   }
   
mysql_free_result($result);
?>

   <input type="submit" name="accion" value="Guardar">
</form>
</body>
</html>
modificaequipo.php
Código PHP:
<?php
   
include("conec.php");
   
$link=Conectarse();   
$Sql="UPDATE ligascenso SET id='".$_POST["id"]."', id_equipo='".$_POST["nombre"]."', gf='".$_POST["favor"]."', gc='".$_POST["contra"]."' ptos='".$_POST["puntos"]."' WHERE id_equipo='".$_POST["nombre"]."'";
   
mysql_query($Sql,$link);
   
header("Location: consultaequipo.htm");
?>
conec.php
Código PHP:
<?php
function Conectarse(){
   if (!(
$link=mysql_connect("localhost","root","")))  {
      exit();
   }
   if (!
mysql_select_db("proevo",$link)){
      exit();
   }
   return 
$link;
}
?>
la consulta.php aparece sin error al buscar el nombre del equipo me aparece esto

Cita:
( ! ) Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\pes\admin\equipo\buscaequipo.php on line 6