progetto di prova che mostra le macchine fiat e un form che permette di contattare
filippo.bertilotti
2024-04-24 3664667a05b1ee32df704303d44720d178215eb9
aggiunta verifica per email e aggiunta stringa vuota per stampa senza errore
1 files modified
20 ■■■■■ changed files
htdocs/contact.php 20 ●●●●● patch | view | raw | blame | history
htdocs/contact.php
@@ -10,18 +10,24 @@
    $number = $_GET['number'] ?? '';
    $email = $_GET['email'] ?? '';
        if(!is_numeric($number) && strlen($number) != 10) {
            $error['number'] = 'Numero di telefono non corretto';
        }
        if(true) {
            $error['email'] = 'email non valida';
        }
    if(!is_numeric($number) || strlen($number) != 10) {
        $error['number'] = 'Numero di telefono non corretto';
    }else {
        $error['number'] = '';
    }
    if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $error['email'] = 'Email non valida';
    } else {
        $error['email'] = '';
    }
    $smarty->assign('cellNumber', $number);
    $smarty->assign('email', $email);
    $smarty->assign('error', $error);
    $smarty->display('contact.tpl');
?>