Tengo un formulario que utilizo para actualizar los valores de una base de datos. El código es el siguiente:
lista_editor.html:
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Editor de la Lista de La Cuenta Atrás</title>
<style type="text/css">
td, select {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#FFFFFF;}
select, input {
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
color:#000000;
size:landscape;}
table {
border-collapse:collapse;}
</style>
</head>
<body bgcolor="#000000" text="#FFFFFF">
<div align="center">
<form action="lista_proc.php" method="post">
<table width="600" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000">
<tr>
<td colspan="4" bgcolor="#990000"><div align="center"><strong>EDITOR DE LA CUENTA ATRAS DE BPV RADIO</strong></div></td>
</tr>
<tr>
<td colspan="4" bgcolor="#CC0000"><div align="center">Semana del
<input name="dia_desde" type="text" id="dia_desde" size="3" maxlength="2">
/
<input name="mes_desde" type="text" id="mes_desde" size="3" maxlength="2">
al
<input name="dia_hasta" type="text" id="dia_hasta" size="3" maxlength="2">
/
<input name="mes_hasta" type="text" id="mes_hasta" size="3" maxlength="2">
</div></td>
</tr>
<tr>
<td bgcolor="#CC9900"><div align="center"><strong>Puesto</strong></div></td>
<td bgcolor="#CC9900"><div align="center"><strong>Progreso</strong></div></td>
<td bgcolor="#CC9900"><p align="center"><strong>Autor</strong></p> </td>
<td bgcolor="#CC9900"><div align="center"><strong>Tema</strong></div></td>
</tr>
<tr>
<td bgcolor="#000066"><div align="center"><strong>1</strong></div></td>
<td width="150"><div align="center">
<select name="progress_1" id="progress_1">
<option value="↑" selected>Sube</option>
<option value="↓">Baja</option>
<option value="=">Repite</option>
<option value="N">Nueva entrada</option>
</select>
</div></td>
<td><div align="center">
<input name="autor_1" type="text" id="autor_1" size="40" maxlength="32">
</div></td>
<td><div align="center">
<input name="tema_1" type="text" id="tema_1" size="40" maxlength="32">
</div></td>
</tr>
<tr>
<td bgcolor="#000066"><div align="center"><strong>2</strong></div></td>
<td><div align="center">
<select name="progress_2" id="progress_2">
<option value="↑" selected>Sube</option>
<option value="↓">Baja</option>
<option value="=">Repite</option>
<option value="N">Nueva entrada</option>
</select>
</div></td>
<td><div align="center">
<input name="autor_2" type="text" id="autor_2" size="40" maxlength="32">
</div></td>
<td><div align="center">
<input name="tema_2" type="text" id="tema_2" size="40" maxlength="32">
</div></td>
</tr>
(... etc, etc hasta 20)
<tr>
<td colspan="4" bgcolor="#000000"><div align="center">
Password de acceso:
<input name="password" type="text" id="password" maxlength="10">
<input type="submit" name="Submit" value="Validar">
</div></td>
</tr>
</table>
</form>
</div>
</body>
</html>
lista_proc.php
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin título</title>
</head>
<body>
<?php
echo "<h2>Acceso confirmado</h2>";
// Conexion de la base de datos
include("dbconex.php");
// Modificador de la lista
$k=1;
while ($k<=20) {
$progreso="progress_$k";
$autores="autor_$k";
$temas="tema_$k";
$sql = "UPDATE lista SET progreso='".$$progreso."',
autor='".$$autores."', tema='".$$temas."' WHERE id = $k";
$result = mysql_query($sql);
$k++;
}
$sql = "UPDATE lista_dias SET dia_desde='".$dia_desde."', mes_desde='".$mes_desde."',
dia_hasta='".$dia_hasta."', mes_hasta='".$mes_hasta."'";
$result = mysql_query($sql);
// Listado con los resultados
$result = mysql_query("SELECT id, progreso, autor, tema FROM lista", $dbconex);
$result2 = mysql_query("SELECT dia_desde, mes_desde, dia_hasta, mes_hasta FROM lista_dias", $dbconex);echo "<h2>Lista de la cuenta atrás actualizada con los siguientes datos:</h2>";
while ($row = mysql_fetch_row($result2)){
echo "Semana del $row[0]/$row[1] al $row[2]/$row[3]";
}
echo "<table><tr>";
echo "<td><b>Puesto</b></td><td><b>Progreso</b></td><td><b>Autor, cantante</b></td></tr>";
while ($row = mysql_fetch_row($result)){
echo "<tr> \n";
echo "<td>$row[0]</td> \n";
echo "<td>$row[1]</td> \n";
echo "<td><b>$row[2]</b>, $row[3]</td> \n";
echo "</tr> \n";
}
echo "</table> \n";
?>
</body>
</html>
El caso es que en mi ordenador como tengo register_globals=on esto me funciona, pero al subir la página al servidor que lo tiene desactivado (por seguridad, logicamente) esto no funciona, y como el problema es que tengo un bucle while que hace que las variables progress, autor y tema vayan cambiando de nombre no se como tengo que hacer para poner ahí las variables con el formato $_GET. Ejemplo, he intentado poniendo:
$progreso="$_GET[\"progress_$k\"]";
pero no funciona. Me salen todos los datos en blanco.