Ciao ragazzi!
Ho il seguente problema.
In una pagina PAG1 ho il seguente script, che fa una lista con checkbox di fianco.
L'utente spunta le checkbox e nella pagina ricvente vorrei leggere per quali valori di $COD_LE le checkbox sono state spuntate.
La pagina chiamante è (parte del codice):
Codice PHP:
...
$cnt_flag =0;
while($Values = mysql_fetch_array($result))
{
$COD_LE= $Values['COD_LE'];
$FLG_LE_EDIT = $Values['FLG_LE_EDIT'];
$DESCR_1 = $Values['DESCR_1'];
print "<input type='hidden' name='COD_LE[$cnt_flag]' value='$COD_LE'>";
print " Ragione sociale: <input type='text' size='40' name='DESCR_1'
value='$DESCR_1' disabled='disabled' >";
print " <input type= 'checkbox' size='40' name='FLG_LE_EDIT[$cnt_flag]'";
if($FLG_LE_EDIT == 1) {print "checked='checked'"; } else print "";
print">";
print "
";
++$cnt_flag;
}
La pagina richiamata dal form è:
Codice PHP:
$size = count($_POST['COD_LE']); //conta il numero di flag
$USER_ID= $_POST['USER_ID'];
$i = 0;
while ($i < $size) {
// define each variable
$COD_LE= $_POST['COD_LE'][$i];
$FLG_LE_EDIT = $_POST['FLG_LE_EDIT'][$i];
...
Solo che per la riga: $FLG_LE_EDIT = $_POST['FLG_LE_EDIT'][$i]; mi dà l'errore:
Notice: Undefined offset: 1 in C:\Documents and Settings\david\Documenti\personali\PHP\SW\SSP\GEST IONE\new_usr_dett.php on line 58
Notice: Undefined offset: 2 in C:\Documents and Settings\david\Documenti\personali\PHP\SW\SSP\GEST IONE\new_usr_dett.php on line 58
Notice: Undefined offset: 3 in C:\Documents and Settings\david\Documenti\personali\PHP\SW\SSP\GEST IONE\new_usr_dett.php on line 58
etc..
Nota: l'errore me lo dà per
$_POST['FLG_LE_EDIT'][$i] ma non per $_POST['COD_LE'][$i].
Sapete perché? Text e checkbox hanno comportamenti diversi?
Grazie mille e ciao a tutti!