Ciao,
ho un piccolo problema che non é grave ma se si puo risolvere sarebbe bello, mi spiego;
quando tento di inserire dati nel db se non inserisco niente nei campi mi da il messaggio di errore giusto, se li compilo tutti me inserisce senza problemi, il problema sta quando per esempio compilo solo il primo campo e poi inserisco, ecco io qui non vorrei che si inserisce solo compilando il primo campo, ma vorrei che se lutente compila solo il primo campo mi da il messaggio di errore compilare tutti i campi, il mio codice é il seguente;
Codice PHP:
<?php
$currentDate = date("d/m/Y");
if (isset($_POST['Submit'])
and empty($_POST['call_callsign'])
and empty($_POST['call_sTime'])
and empty($_POST['call_reportOut'])
and empty($_POST['call_reportIn'])
and empty($_POST['call_remarks'])
and empty($_POST['call_user'])
and empty($_POST['call_qslIn'])
and empty($_POST['call_qslOut'])) {
$msg = "Inserire tutti i campi";
} else {
if(isset($_POST['Submit']) && $_GET['action'] == "insert") {
mysql_select_db($database_name, $conn) or die (mysql_error());
$query = "INSERT INTO tb_contact (call_callsign, call_date, call_sTime, call_band, call_mode, call_power, call_reportOut, call_reportIn, call_remarks, call_user, call_qslIn, call_qslOut, call_contest) VALUES ( '".$_POST['call_callsign']."',
'".$_POST['call_date']."',
'".$_POST['call_sTime']."',
'".$_POST['call_band']."',
'".$_POST['call_mode']."',
'".$_POST['call_power']."',
'".$_POST['call_reportOut']."',
'".$_POST['call_reportIn']."',
'".$_POST['call_remarks']."',
'".$_POST['call_user']."',
'".$_POST['call_qslIn']."',
'".$_POST['call_qslOut']."',
'".$_POST['call_contest']."'
)";
mysql_query($query);
$msg = "Contatto aggiunto correttamente";
}
}
?>
Grazie Michel