Fatto in questo modo:
PAGINA SALVA
Codice PHP:
<?php
session_start();
$sez = $_SESSION['votazione']['sez'];
$data = $_SESSION['votazione']['data'];
?>
<?php
include("../include/top_foot.inc.php");
?>
</head>
<?php
foreach($_SESSION['votazione'] as $row){
$query = "INSERT INTO pref03 (sez, numero_cand, candidato, numero_lista, voti)
VALUES ('{$_POST['sez']}', '{$row['num_cand']}', '{$row['candidato']}', '{$row['numero_lista']}', '{$row['voti']}')";
mysql_query($query);
}
?>
foreach($_SESSION['votazione'] as $row){
$query = "INSERT INTO pref03 (sez, numero_cand, candidato, numero_lista, voti)
VALUES ('{$_POST['sez']}', '{$row['num_cand']}', '{$row['candidato']}', '{$row['numero_lista']}', '{$row['voti']}')";
mysql_query($query);
}
//header("Location: preferenze_cerca.php");
//exit;
?>
PAGINA VERIFICA
Codice PHP:
<?php
session_start();
$count = 0;
foreach($_POST['data'] as $row){
$count += $row['voti'];
}
$_SESSION['votazione']= array('sez'=>$_POST['sez'], 'data'=>$_POST['data']);
?>
il Totale dei voti è : <?php echo $count ?>
<input type="hidden" name="data[<?php echo $row['id'] ?>][numero_lista]" size="70" value="<?php print $row['numero_lista']; ?>">......
mi da i seguenti errori
Notice: Undefined index: sez in line 22
Warning: Illegal string offset 'num_cand' in line 22
Warning: Illegal string offset 'candidato' in line 22
Warning: Illegal string offset 'numero_lista' in line 22
Warning: Illegal string offset 'voti' in line 22
Notice: Undefined index: sez in line 22
Notice: Undefined index: num_cand in line 22
Notice: Undefined index: candidato in line 22
Notice: Undefined index: numero_lista in line 22
Notice: Undefined index: voti in line 22