Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/03/2008, 05:38
Rigstor
 
Fecha de Ingreso: marzo-2008
Mensajes: 2
Antigüedad: 16 años, 1 mes
Puntos: 0
Re: Valores de text y checkbox en PHP

Vaya, no me he explicado demasiado bien :S
El problema esta en que la pagina es esclusivamente PHP, no recoge nada de un form anterior de una pagina HTML. El caso es que no se si se puede hacer que me identifique los valores que tiene cada textbox en los que escribire para despues poder hacer una sentencia UPDATE en MYSQL. El codigo entero (aun esta en obras, faltan cosas) de la pagina seria el siguiente:
<?php
session_start();
$codUsu = $_SESSION["cod_usuario"];
if (!isset($codUsu)){
header("Location: ../html/Login.html");
}
$hndCon = @mysql_connect("localhost","prueba","prueba");
if (!$hndCon)
{
$strError = "Imposible conectar con la BD";
if ($hndLog = Abrir($fLog)){
$texto = "[".date("d-m-Y G\:i\:s")."][2][".$usu."][".$strError."]\n";
Escribir($hndLog,$texto);
}
header("Location: ../html/Login.html");
exit;
}
$hndDb = mysql_select_db('jorge',$hndCon);
if (!$hndDb)
{
$strError = "Imposible conectar con la BD";
if ($hndLog = Abrir($fLog)){
$texto = "[".date("d-m-Y G\:i\:s")."][2][".$usu."][".$strError."]\n";
Escribir($hndLog,$texto);
}
header("Location: ../html/Login.html");
exit;
}
$strUs = "select usuario, clave, activo " ;
$strUs .= "from usuarios ";
$strUs .= "where id_usuario = ".$codUsu;
$hndQr = mysql_query($strUs,$hndCon);
if (!$hndQr)
{
header("Location: ../html/Login.html");
exit;
}
$numFl = mysql_num_rows($hndQr);
if ($numFl == 0)
{
$strError = "No existe el usuario";
if ($hndLog = Abrir($fLog)){
$texto = "[".date("d-m-Y G\:i\:s")."][2][".$usu."][".$strError."]\n";
Escribir($hndLog,$texto);
}
if ($hndDb){
$strIns = "Insert into log (usuario,fecha,dsc,id_tipo) ";
$strIns .= "values('".$usu."' , '".date("Y-m-d G:i:s")."' , '".$strError."' , 2)";
mysql_query($strIns,$hndCon);
}
header("Location: ../html/Login.html");
exit;
} else {
while($arUsu = mysql_fetch_object($hndQr))
{
$activo = $arUsu->activo;
$usuario = $arUsu->usuario;
$clave = $arUsu->clave;
}
}
echo "<table align='center' border=1>";
echo "<tr>";
echo "<td align='right'>Nombre usuario:";
echo "<td align='center'><input type='text' name=\"usu\" value=$usuario>";
echo "</tr>";
echo "<tr>";
echo "<td align='right'>Clave:";
echo "<td align='center'><input type='password' name=\"cl1\">";
echo "</tr>";
echo "<tr>";
echo "<td align='right'>Nueva clave:";
echo "<td align='center'><input type='password' name=\"cl2\">";
echo "</tr>";
echo "<tr>";
echo "<td align='right'>Repita clave:";
echo "<td align='center'><input type='password' name=\"cl3\">";
echo "</tr>";
echo "<tr>";
echo "<td align='right'>Activo:";
echo "<td align='center'><input type=text name=\"ch1\" value=$activo>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=2 align='center'>";
echo "<input type='button' value='Aceptar'> ";
echo "<input type='button' value='Cancelar'";
echo "</table>";
?>