Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    Problema con check box e php

    E' da qualche giorno che sto cercando di risolvere un problema...,...
    devo aggiornare il record di una tabella mysql,... in base alle check box selezionate...
    http://www.vincentandfrank.tk

  2. #2
    si ma qual'è il tuo problema specifico?
    prova a postare del codice

  3. #3
    Allora questo è il codice che uso nella pagina per fare la lista...

    <?
    include ('config.php');
    include ('autenticato.php');

    $query= "select ID,COD,NOME,COGNOME from tabella1 where startup ='0' and incarico='0' order by ID";
    $result= mysql_query($query);
    $numfields = mysql_num_fields($result);

    echo "<center><form id='prensete' method='post' action='segna_presente.php'><table>\n<tr><td/><td>CODICE</TD><TD>NOME</TD><TD>COGNOME</TD></TR>";
    //for ($i=0; $i < $numfields; $i++)
    // {
    // echo '<th>'.mysql_field_name($result, $i).'</th>';
    // }
    // echo "</tr>\n";


    while ($row = mysql_fetch_row($result))
    {
    $conta++;
    echo "<tr><td><input type='checkbox' name='chk".$row[0]."' value='1'></td><td>".$row[1]."</td><td>".$row[2]."</td><td>".$row[3]."</td></tr>";

    }

    echo "</table><input type='submit' value='Presenti'></form></center>\n";


    ?>

    questa e la pagina segna_presente.php mi da errore nella line 6

    <?
    $conta=$_POST['presenti'];

    for (i = 1; i <= $conta; i+=1) {

    $ckbox.$i = $_POST['chk'.$i];

    if($ckbox.$i == 1) {

    $sql = "UPDATE tabella SET STARTUP = '1' WHERE ID ='$i'";
    $result= mysql_query($sql);


    }


    }


    ?>
    http://www.vincentandfrank.tk

  4. #4
    mi da quest'errore
    Parse error: syntax error, unexpected '=', expecting ';' in /home/visualba/public_html/ODC_CONTROLLO NOMITATiVI/segna_presente.php on line 6
    http://www.vincentandfrank.tk

  5. #5
    for (i = 1; i <= $conta; i+=1) {

    i non è una variabile cosi..

    for ($i = 1; $i <= $conta; $i+=1) {

  6. #6
    ok adesso funziona... ma nn mi fa l'update nella tabella...
    http://www.vincentandfrank.tk

  7. #7
    Ho sostituito il codice precendente con questo
    <?
    include ("config.php");

    $conta=$_POST['presenti'];

    echo $conta;

    for ($i = 1; $i <= $conta; $i+=1) {

    $ckbox.$i = $_POST['chk'.$i];

    if($ckbox.$i == 1) {
    echo "
    ".$ckbox.$i;
    $sql = "UPDATE odc SET STARTUP = '1' WHERE ID ='$i'";
    $result= mysql_query($sql);


    }


    }


    ?>

    adesso mi da quest'errore
    Fatal error: Maximum execution time of 30 seconds exceeded in /home/visualba/public_html/ODC_CONTROLLO NOMITATiVI/segna_presente.php on line 12
    http://www.vincentandfrank.tk

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.