Ver Mensaje Individual
  #18 (permalink)  
Antiguo 15/12/2016, 09:01
rbczgz
 
Fecha de Ingreso: noviembre-2003
Ubicación: Zaragoza, España
Mensajes: 1.257
Antigüedad: 20 años, 5 meses
Puntos: 154
Respuesta: radio buttom php sql update.

Hola spark21,

Prueba también la validación así:

Código PHP:
Ver original
  1. if (isset($_POST['active_next']) && !empty($_POST['active_next']) ) {
  2. $active_next = $_POST['active_next'];
  3.     $query_next = "UPDATE blocks SET active=$active_next WHERE content_file='next_events'";
  4.     $result_next = mysql_query($query_next);
  5.     if (!$result_next) error("MySQL Error: ".mysql_error()."\n");

De todas formas, lo que se me había pasado por alto, es la depuración, que es lo primero que deberíamos haber hecho...:

Código PHP:
Ver original
  1. echo "Valor de \$_POST['active_next']: " . $_POST['active_next']; //Aquí vemos si trae algo.
  2.     if (isset($_POST['active_next'])) {
  3.     $active_next = $_POST['active_next']; // Tenemos que asignar la variable $_POST a la variable local
  4.     $query_next = "UPDATE blocks SET active='$active_next' WHERE content_file='next_events'";
  5.     $result_next = mysql_query($query_next);
  6.     if (!$result_next) error("MySQL Error: ".mysql_error()."\n");

En función de lo que te muestre, podremos seguir...

Última edición por rbczgz; 15/12/2016 a las 09:04 Razón: Faltaba código.