Here's the code of my form:
<FORM NAME="Form" METHOD=POST ACTION="add.php3">
<input type=hidden name="redirect" value=
"
http://www.digitaldummies.coolfreehost.com/1.html">
<B><font color="red">Subscribe to our free <b>Computer Viruses'</b> Magazine:</font>
<input type="TEXT" name="01)add" value="your email here" size=17>
<center><input type="submit"></center>
</form>
And here's the code of my recently tried PHP program:
<?php
######################################################################
# FORM DATA COLLECTOR
# Filename: DataCollector.php
# Created: 23/06/2003
# Modified: 23/06/2003
# ==============
# Copyright (c) 2003 by Ashley Young (
ash@evoluted.net)
#
http://evoluted.net
# ==============
#
# Description
# ===========
# Saves data sent to the form either by POST or GET to a file specified
# below, CSV form. It allows multiple data files to save the data to and
# there is no limit on the number of fields stored.
#
# Usage
# =====
# The only thing that requires changing in this file
# is the paths to the data files. You then access the file like so:
#
# data.php?n=DATA&1=first_item_to_save&2=second_item&3=third etc
#
# Replacing DATA with a number from below relating to the datafile
# you wish to save the information in
#
# The file saves all data specified by POST or GET in the order which
# it is presented to the file. The first variable being saved in the
# first column, second variable in the second column and so on. It is
# however assuumed that the first variable supplied will be specifying
# the datafile number and the variable will be called 'n'.
#
# Variables
# =========
######################################################################
$data[0] = "file.txt";
$data[4] = "second.txt";
$data[1] = "l.txt";
$data[2] = "/l.txt"; // Just add more as required
######################################################################
# DO NO CHANGE ANYTHING BELOW THIS POINT
######################################################################
if(!$fp = fopen($data[$_REQUEST['n']], "a")) die ("Cannot open data file");
array_shift($_REQUEST);
$size = sizeof($_REQUEST);
for($i=0; $i<$size; $i++) {
$str = $str . array_shift($_REQUEST);
if(!($i==($size-1))) {
$str = $str . ", ";
}
}
fwrite($fp, $str . "\n\r");
echo "<p>Thank You</p><p>The data was successfully saved.</p>";
?>