From 0ef344b67a8f7db3835d592c1e2af956d6e156aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gestor=C3=ADa=20LP?= Date: Mon, 2 Mar 2026 00:11:42 +0000 Subject: [PATCH] feat: form submission handler with email + WhatsApp notifications Co-Authored-By: Claude Opus 4.6 --- assets/css/style.css | 45 +++++++++++++++++++++++++ confirmacion.php | 35 ++++++++++++++++++++ formulario.php | 78 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 confirmacion.php create mode 100644 formulario.php diff --git a/assets/css/style.css b/assets/css/style.css index 5e897df..11504ba 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1222,6 +1222,51 @@ select.form-control { margin-bottom: var(--space-xs); } +/* ============================================================ + Confirmation Page + ============================================================ */ +.confirmation-section { + display: flex; + align-items: center; + justify-content: center; + min-height: 60vh; + padding-top: 120px; +} + +.confirmation-card { + text-align: center; + max-width: 500px; + margin: 0 auto; + padding: var(--space-3xl); + background: var(--color-white); + border-radius: var(--radius-lg); + box-shadow: var(--shadow-lg); +} + +.confirmation-card__icon { + font-size: 4rem; + color: var(--color-success); + margin-bottom: var(--space-lg); +} + +.confirmation-card h1 { + color: var(--color-primary); + margin-bottom: var(--space-md); +} + +.confirmation-card p { + color: var(--color-gray-600); + margin-bottom: var(--space-sm); +} + +.confirmation-card__actions { + margin-top: var(--space-xl); + display: flex; + flex-direction: column; + gap: var(--space-md); + align-items: center; +} + /* ============================================================ Scroll Animations ============================================================ */ diff --git a/confirmacion.php b/confirmacion.php new file mode 100644 index 0000000..2c93917 --- /dev/null +++ b/confirmacion.php @@ -0,0 +1,35 @@ + + +
+
+
+
+ +
+

¡Solicitud enviada!

+

Gracias , hemos recibido tu solicitud para .

+

Nos pondremos en contacto contigo lo antes posible.

+ +
+
+
+ + diff --git a/formulario.php b/formulario.php new file mode 100644 index 0000000..48c627f --- /dev/null +++ b/formulario.php @@ -0,0 +1,78 @@ +prepare('INSERT INTO solicitudes (nombre, telefono, email, servicio, datos_formulario, estado) VALUES (?, ?, ?, ?, ?, "nueva")'); +$stmt->execute([$nombre, $telefono, $email, $servicio, json_encode($datosExtra, JSON_UNESCAPED_UNICODE)]); + +// Send email notification +$servicioNombre = $SERVICIOS[$servicio]['nombre']; +$emailBody = "
"; +$emailBody .= "
"; +$emailBody .= "

Nueva Solicitud

"; +$emailBody .= "
"; +$emailBody .= "

{$servicioNombre}

"; +$emailBody .= ""; +$emailBody .= ""; +$emailBody .= ""; +$emailBody .= ""; +$emailBody .= "
Nombre:" . htmlspecialchars($nombre) . "
Teléfono:" . htmlspecialchars($telefono) . "
Email:" . htmlspecialchars($email ?: 'No proporcionado') . "
"; +$emailBody .= "

Datos del trámite

"; +$emailBody .= ""; +foreach ($datosExtra as $label => $val) { + $emailBody .= ""; +} +$emailBody .= "
" . htmlspecialchars($label) . ":" . htmlspecialchars($val ?: 'N/A') . "
"; +$emailBody .= "

Recibido el " . date('d/m/Y \a \l\a\s H:i') . "

"; +$emailBody .= "
"; + +sendEmail("Nueva solicitud: {$servicioNombre} - {$nombre}", $emailBody); + +// Build WhatsApp link and store in session +$whatsappLink = buildWhatsAppLink($servicioNombre, $nombre, $telefono); +$_SESSION['whatsapp_link'] = $whatsappLink; +$_SESSION['confirmacion_nombre'] = $nombre; +$_SESSION['confirmacion_servicio'] = $servicioNombre; + +// Regenerate CSRF token +unset($_SESSION['csrf_token']); + +header('Location: confirmacion.php'); +exit;