Buongiorno a tutti ho il seguente problema:
Ho un form :
<form name="form1" method="post" action="check.php">
<td width="238" height="38" valign="bottom"><span class="nero10">
Nome :</span>
<input name="nome" type="text" class="form" id="nome" size="30"></td>
<td width="200" height="38" align="left" valign="bottom"><span class="nero10">
Cognome :</span>
<input name="cognome" type="text" class="form" id="cognome" size="30">
</td>
<td height="118" align="left" valign="middle"><span class="grigio12">
<input name="prodotti[]" type="checkbox" class="form" id="mele" value="mele">mele</span>
<span class="grigio12"><input name="prodotti[]" type="checkbox" class="form" id="pere" value="pere">pere</span>
<img
<span class="grigio12">
<input name="prodotti[]" type="checkbox" class="form" id="pesche" value="pesche">pesche
...............
Tramite questa funzione:
$_CONFIG['table_prodotti'] = "prod";
$_CONFIG['check_table'] = array(
"nome" => "check_global",
"cognome" => "check_global",
);
function check_global($value){
global $_CONFIG;
$value = trim($value);
if($value == "")
return "Il campo non può essere lasciato vuoto";
return true;
}
controllo se i campi nome e cognome sono stati inseriti altrimenti gli mando un alert : Il campo non può essere lasciato vuoto.
Il tutto funziona, vorrei pero' fare una cosa simile anche con le check box come posso fare.
Grazie.