Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <title>Order form</title>
- <body>
- <form method='post' action=''>
- <input type="submit" name="submit" value="Save to .csv file"><br>
- </form>
- </body>
- </html>
- <?php
- if(isset($_POST['submit'])){
- function array_to_CSV()
- {
- $FirstName = $_POST["FirstName"];
- $LastName = $_POST["LastName"];
- $Phone = $_POST["Phone"];
- $StreetNum = $_POST["StreetNum"];
- $StreenName = $_POST["StreetName"];
- $Suburb = $_POST["Suburb"];
- $Postcode = $_POST["Postcode"];
- $Milk = $_POST["Milk"];
- $Bread = $_POST["Bread"];
- $Butter = $_POST["Butter"];
- $Cheese = $_POST["Cheese"];
- $Eggs = $_POST["Eggs"];
- $formInfo = array (
- array("$LastName", "$Phone", "$StreetNum", "$StreetName", "$Suburb", "$Postcode", "$Milk", "$Bread", "$Butter", "$Cheese", "$Eggs")
- );
- $file = fopen("orders1.csv","w");
- foreach ($formInfo as $line) {
- fputcsv($file, $line);
- }
- fclose($file);
- }
- array_to_CSV();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement