| | |
| | | $smarty->setCompileDir('../compile'); |
| | | |
| | | $error = []; |
| | | $number = $_GET['number'] ?? ''; |
| | | $email = $_GET['email'] ?? ''; |
| | | $number = $_POST['number'] ?? ''; |
| | | $email = $_POST['email'] ?? ''; |
| | | |
| | | |
| | | |
| | |
| | | if(!is_numeric($number) || strlen($number) != 10) { |
| | | $error['number'] = 'Numero di telefono non corretto'; |
| | | }else { |
| | | $error['number'] = ''; |
| | | //$error['number'] = ''; |
| | | } |
| | | |
| | | if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
| | | $error['email'] = 'Email non valida'; |
| | | } else { |
| | | $error['email'] = ''; |
| | | //$error['email'] = ''; |
| | | } |
| | | |
| | | |
| | | if(count($error) == 0) { |
| | | try { |
| | | $conn = new mysqli('127.0.0.1', 'root', '', 'contact_db'); |
| | | } catch (Exception $e) { |
| | | die($e->getMessage()); |
| | | } |
| | | |
| | | try { |
| | | $conn = new mysqli('127.0.0.1', 'root', '', 'contact_db'); |
| | | } catch (Exception $e) { |
| | | die($e->getMessage()); |
| | | |
| | | |
| | | insertDataOnTable($conn, $email, $number); |
| | | } |
| | | |
| | | insertDataOnTable($conn, $email, $number); |
| | | |
| | | |
| | | |
| | | |