From ea3eaf84c6de3f96d6bb73e817147f8571fd6c1f Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 30 Jun 2025 17:22:26 +0200 Subject: formulaire de contact 2 --- src/controller/ajax.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/controller/ajax.php') diff --git a/src/controller/ajax.php b/src/controller/ajax.php index a462921..ae43b75 100644 --- a/src/controller/ajax.php +++ b/src/controller/ajax.php @@ -353,6 +353,24 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json'){ echo json_encode(['success' => true]); die; } + + // config formulaire + elseif($_GET['action'] === 'recipient_email'){ + $form_data = $entityManager->find('App\Entity\NodeData', $json['id']); + $email = htmlspecialchars(trim($json['email'])); + + if(filter_var($email, FILTER_VALIDATE_EMAIL)){ + $form_data->updateData('email', $json['email']); + $entityManager->persist($form_data); + $entityManager->flush(); + echo json_encode(['success' => true]); + die; + } + else{ + echo json_encode(['success' => false]); + die; + } + } } -- cgit v1.2.3