-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.php
More file actions
28 lines (24 loc) · 795 Bytes
/
save.php
File metadata and controls
28 lines (24 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// Save form data to database
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Generate token with encoded form data
$formData = array(
'name' => $name,
'email' => $email,
'message' => $message
);
$token = base64_encode(json_encode($formData));
// Send email to user with token URL
$to = $email;
$subject = 'Your token URL';
$message = "Here's your token URL: https://yourwebsite.com/form1/index.php?token=$token";
$headers = 'From: webmaster@yourwebsite.com' . "\r\n" .
'Reply-To: webmaster@yourwebsite.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
// Redirect to thank you page
header('Location: thank-you.php?token=' . urlencode($token));
exit;
?>