progetto di prova che mostra le macchine fiat e un form che permette di contattare
filippo.bertilotti
2024-04-24 0398ab0d1b3893cec909fbccb5596b7fb5262c51
refactor codice per migliorarne la struttura
1 files modified
23 ■■■■ changed files
htdocs/contact.php 23 ●●●● patch | view | raw | blame | history
htdocs/contact.php
@@ -6,21 +6,22 @@
    $smarty->setTemplateDir('../ihtml');
    $smarty->setCompileDir('../compile');
    $error = [];
    $number = $_GET['number'] ?? '';
    $email = $_GET['email'] ?? '';
    if(!empty($_GET['number']) && !empty($_GET['email'])) {
        if(is_numeric($_GET['number']) && strlen($_GET['number']) == 10) {
            $number = $_GET['number'];
            $email = $_GET['email'];
        }else {
            $number = 'Numero di telefono non corretto';
            $email = '';
        if(!is_numeric($number) && strlen($number) != 10) {
            $error['number'] = 'Numero di telefono non corretto';
        }
    }else {
        $number = '';
        $email = '';
    }
        if(true) {
            $error['email'] = 'email non valida';
        }
    $smarty->assign('cellNumber', $number);
    $smarty->assign('email', $email);
    $smarty->assign('error', $error);
    $smarty->display('contact.tpl');
?>