Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = $_POST['name'];
- $email = $_POST['email'];
- $date = $_POST['date'];
- $destination = $_POST['destination'];
- $msg = $_POST['msg'];
- //TODO the file write here VV, use 'a' instead of 'w' too ADD to the file instead of REWRITING IT.
- $arr = [$name,$email,$date,$destination,$msg];
- $write = json_encode($arr);
- echo $write;
- $file = fopen('data.txt', 'a');
- fwrite($file, $write);
- fclose($file);
- // echo $arr[];
- ?>
- ["Simon","example@example.com","0101-01-01T01:01","Ohio","Message here"][null,null,null,null,null]
- <?php
- if (isset($_POST['name'])
- && isset($_POST['email'])
- && isset($_POST['date'])
- && isset($_POST['destination'])
- && isset($_POST['msg'])) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $date = $_POST['date'];
- $destination = $_POST['destination'];
- $msg = $_POST['msg'];
- //TODO the file write here VV, use 'a' instead of 'w' too ADD to the file instead of REWRITING IT.
- $arr = [$name,$email,$date,$destination,$msg];
- $write = json_encode($arr);
- var_dump( $write);
- $file = fopen('data.txt', 'a');
- fwrite($file, $write);
- fclose($file);
- // echo $arr[];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement