Jump to content

Newbe PHP help


oren.gozlan

Recommended Posts

If you just want to put the contents of what was posted in a file then try this (with comments included):

[code]<?php
// file name and location
$file_to_write = "/var/tmp/post.txt";

// open the file for writing and assign to a resource id ($file)
$file = fopen($file_to_write, "w");

// write a header to the file
fwrite($file, "The following entries were posted:\n\n");

// write a row in the file for each of the posted elements
foreach ($_POST as $key => $value){
  fwrite($file, "$key: $value\n");
}

// close the file
fclose($file);
?>[/code]

Incidentally, I took these instructions directly from the [url=http://uk.php.net/manual/en/]PHP Manual[/url]!  A first stop for every PHP Newbie.

Regards
Huggie
Link to comment
https://forums.phpfreaks.com/topic/25903-newbe-php-help/#findComment-118336
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.