-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_data.php
37 lines (30 loc) · 932 Bytes
/
user_data.php
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
29
30
31
32
33
34
35
36
37
<?php
//fetching the data from the form
$name = $_POST["fname"];
$email = $_POST["email"];
$date_of_birth = $_POST["date"];
$gender = $_POST["gender"];
$country = $_POST["country"];
$output = "{$name} ,";
$output .= "{$email} ,";
$output .= "{$date_of_birth} , ";
$output .= "{$gender} ,";
$output .= "{$country} ";
$output .= "\n";
$filename ="userdata.csv";
$fhandle = fopen($filename, "a");
fwrite($fhandle, $output); // fwrite($fhandle, $email);
// fwrite($fhandle, $date_of_birth);
// fwrite($fhandle, $gender);
// fwrite($fhandle, $country);
fclose ($fhandle); // close file
echo "Name: {$name}";
echo "<br>";
echo "Email: {$email}";
echo "<br>";
echo "Date of birth: {$date_of_birth}";
echo "<br>";
echo "Gender: {$gender}";
echo "<br>";
echo "Country: {$country}";
?>