Submit form results to file/folder

This is a discussion on "Submit form results to file/folder" within the PHP Forum section. This forum, and the thread "Submit form results to file/folder are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 26th, 2006, 16:13
New Member
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Submit form results to file/folder

How do i get my form results sent straight to a file/folder in my web directory. I need to be able to view results from submissions such as checkboxex, radio and text boxes without a new one overwriting the old one before i view it



HELP!!!!!!!!!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 26th, 2006, 16:44
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

Thats where mysql comes in. Everytime the form is submitted you enter that record into the db.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 1st, 2006, 14:29
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

Quote:
Originally Posted by cat101
How do i get my form results sent straight to a file/folder in my web directory. I need to be able to view results from submissions such as checkboxex, radio and text boxes without a new one overwriting the old one before i view it
What exactly are you doing with the form information?

You could take the form info, for example, and email it to yourself so you would always have a 'hard copy' so to speak.

Or, as has already been suggested, you could store the info in a database for future use.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 3rd, 2006, 21:40
Junior Member
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

If you want to write the contents of a feedback form to a directory on your server then just use the PHP file management commands, e.g. fopen, fwrite and fclose.

You can easily create a random file name on the fly each time and check it hasn't been created previously so that you don't overwrite existing files.

Cheers

Dan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 7th, 2006, 17:06
New Member
Join Date: Nov 2006
Location: Italy
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
PHP: I cannot save the form's content on file...

I cannot save the form's content on file (on the local directory where the html/php file is).
Both the HTML and the PHP parts seem to work when "isolated".
When I combine them (to be able to save what has been inserted),
it does not work.

Thank you for any suggestion,
Pietro



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
<title>Test</title>
</head>

<body>
<form enctype="text/plain" method="POST" name="TestForm"/>
<p />
Input anything: <input type="text" name="anything" value="Default"/> <br />
<input type="submit" value="OK" name="submit"/>
</form>
<?php
$fh = fopen("form_output.txt", w);
fwrite($fh, anything);
fclose($fh);
?>
</body>

</html>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 7th, 2006, 20:19
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

That's because you have no php code to collect the values that were 'POSTed'.

It would also have been better to have started a new thread with your query.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 8th, 2006, 08:41
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP: I cannot save the form's content on file...

Quote:
fwrite($fh, anything);
You've got an immediate mistake in that you're missing a $ in this statement - it should read $anything. And I would suggest that you use the longer $_REQUEST[anything] instead, as the shorter form isn't available on all servers - it's regarded as insecure, and may not be switched on.

Plenty else I could comment on, but that should get you started
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Nov 8th, 2006, 13:38
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

Why don't you send the info to a unique database and review it, then export it either to a file or a permanent database?

It just seems like a good idea not to let users access your file system until you're really confident about your security skills.

(I'm so chicken I don't upload anything to my files except by ftp.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Nov 8th, 2006, 15:13
New Member
Join Date: Nov 2006
Location: Italy
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

I cannot use a DB for many reasons.

This code should be closer to the right solution, but it does not work, yet:

HTML: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
    <title>Test</title>
  </head>

  <body>
    <form enctype="text/plain" method="POST" name="TestForm" action="form_output.txt">
      <p />
      Input anything: <input type="text" name="anything" value="Default"/> <br />
      <input type="submit" value="OK" name="submit"/>
    </form>
    <?php
      if ($_POST['submit']=='OK')  {
        $fh = fopen("form_output.txt", 'w');
        fwrite($fh, $_POST['anything']);
        fclose($fh);
      }
    ?>
  </body>
</html>

All I need is the form contents on a local file (in the same directory where the html/php file is)...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Nov 10th, 2006, 13:00
Junior Member
Join Date: Oct 2006
Location: Uxbridge, West London
Age: 26
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Submit form results to file/folder

What version of PHP are you using as you may need to change $_POST to $HTTP_POST_VARS.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
submit, form, results, filefolder

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit options and open results in a new window xshane JavaScript Forum 2 May 21st, 2008 10:23
Display results of a submit form (getting url) in same window?? jahphill JavaScript Forum 12 Nov 29th, 2007 00:18
Multi file uploader and folder create 737mechanic PHP Forum 1 Sep 29th, 2007 11:03
submit many forms - auto submit the same form many times divs JavaScript Forum 0 May 24th, 2007 10:10
Folder and file management pengyou Starting Out 4 May 23rd, 2007 08:23


All times are GMT. The time now is 14:03.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved