Created
May 16, 2012 20:59
-
-
Save alganet/2713910 to your computer and use it in GitHub Desktop.
PHP Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = $_POST['contact']; //get all fields (contact[full_name], etc) | |
ksort($data); //sort the fields by name, so changing the order on HTML don't change the order in the spreadsheet | |
$fileHandle = fopen('contact.csv', 'a'); //opens the contact.csv file, creates it if doesn't exist, place the cursor at the end of the file | |
fputcsv($fileHandle, array($contact_data)); //write contact data to the end of the file | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="post" action="contact.php"> | |
<label>Full Name: <input type="text" name="contact[full_name]"></label> | |
<label>Phone: <input type="text" name="contact[phone]"></label> | |
<label>Message: <textarea name="contact[message]"></textarea></label> | |
<button type="submit">Enviar</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment