progetto di prova che mostra le macchine fiat e un form che permette di contattare
filippo.bertilotti
2024-04-24 c34154c6ba1f55e401c13ee89560aec31d7fa1c1
aggiunta campo email e controllo su numero di telefono
2 files modified
24 ■■■■■ changed files
htdocs/contact.php 16 ●●●●● patch | view | raw | blame | history
ihtml/contact.tpl 8 ●●●● patch | view | raw | blame | history
htdocs/contact.php
@@ -7,16 +7,20 @@
    $smarty->setCompileDir('../compile');
    if(!empty($_GET['prova'])) {
        if(is_numeric($_GET['prova']) && strlen($_GET['prova']) == 10) {
            $string = $_GET['prova'];
    if(!empty($_GET['number']) && !empty($_GET['email'])) {
        if(is_numeric($_GET['number']) && strlen($_GET['number']) == 10) {
            $number = $_GET['number'];
            $email = $_GET['email'];
        }else {
            $string = 'Numero di telefono non corretto';
            $number = 'Numero di telefono non corretto';
            $email = '';
        }
    }else {
        $string = '';
        $number = '';
        $email = '';
    }
    $smarty->assign('provastring', $string);
    $smarty->assign('cellNumber', $number);
    $smarty->assign('email', $email);
    $smarty->display('contact.tpl');
?>
ihtml/contact.tpl
@@ -11,10 +11,14 @@
    <main>
        {* FORM *}
        <form action="contact.php">
            <input type="text" name="prova" placeholder="metti qualcosa">
            Inserisci l'email:
            <input type="email" name="email" placeholder="inserisci l'email"> <br>
            Inserisci il numero:
            <input type="text" name="number" placeholder="inserisci il numero"> <br>
            <button type="submit">clicca qui</button>
        </form>
        {$provastring}
        {$cellNumber}
        {$email}
    </main>
    {include file="footer.tpl"}
</body>