Skip to content

Instantly share code, notes, and snippets.

@meskarune
Created June 3, 2013 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meskarune/5702424 to your computer and use it in GitHub Desktop.
Save meskarune/5702424 to your computer and use it in GitHub Desktop.
php file save script
<?php
$title = @$_POST['title'];
$date = @$_POST['date'];
$excerpt = @$_POST['excerpt'];
$tags = @$_POST['tags'];
$comment = @$_POST['comment'];
// Write the name of text file where data will be store
$filename = "mydata.txt";
// Merge all the variables with text in a single variable.
$f_data= '
title: '.$title.'
date: '.$date.'
excerpt: '.$excerpt.'
tags: '.$tags.'
body: '.$comment.'
==============================================================================
';
echo 'Form data has been saved to '.$filename.' <br>
<a href="'.$filename.'">Click here to read </a> ';
$file = fopen($filename, "w");
fwrite($file,$f_data);
fclose($file);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment