gymway
04-14-2011, 05:39 PM
I'm trying to get a program to work that will allow the user to enter a name and email address which is saved to a .dat file, then enter a message which is saved to a .txt file. It then should display the finished product showing the name and email from the .dat file, followed by the message in the .txt file. The user then should have the option to edit an existing file, or create a new one. I'm running in to issues getting the entered data to write to said files. The results display as "Array" rather than what was actually entered, and it doesn't look as if the entered form information is actually writing to the .txt file when I download and open it up. My code is as follows. Any help would be appreciated.
maillist.php:
<html>
<body>
<p>To create spam, enter your name and mail</p>
<form name="input" method="post"
action="body_mail_merge.php">
<p><label for="name">Name: </label>
<input type="text" name="name" id="name" /></p>
<p><label for="email">Email: </label>
<input type="text" name="email" id="email" /></p>
<p><input type="reset" name="reset" value="reset" />
<input type="submit" name="submit" value="submit" /></p>
</form>
</body>
</html>
<?php
if (isset($_POST["submit"])) {
$name = $_POST["name"];
$email = $_POST["email"];
//fp = file pointer
$fp = fopen("maillist.dat", "a+");
//puts body (email list) into file mailist.dat
fputs($fp, $name, $email);
//closes connection to file used.
fclose($fp);
Print"The mail list has been created for your SPAM. \"mailist.dat\"";
}
?>
body_mail_merge.php:
<html>
<body>
<p>Spam Body Page</p>
<form action="mailmerge.php" method="POST" name="form1" >
Spam Message:<br />
<textarea name="message" value="message" rows="15" cols="40">
</textarea><br />
<input type="Submit" />
</form>
</body>
</html>
<?php
if (isset($_POST["Submit"])) {
$body = $_POST["message"];
//this creates a file pointer to the new file with write permissions.
$fp = fopen("spamBody.txt", "a+");
//creates file in the folder
fputs($fp, $body);
//close file pointer
fclose($fp);
print"The body has been created for your SPAM. File name:spamBody.txt";
}
?>
mailmerge.php:
<html>
<body>
<p>Here is what your SPAM message will look like:</p>
<?php
$theData = file("maillist.dat");
$theBody = file("spamBody.txt");
$message = <<<HERE
Email: $theBody
<br>
<br>
Spam Body: $theData
<br>
<br>
Sincerely,
<br>
<br>
BG Spammer
HERE;
print"$message";
?>
<p>Return to the <a href="maillist.php">Main Page</a>.</p>
</body>
</html>
maillist.php:
<html>
<body>
<p>To create spam, enter your name and mail</p>
<form name="input" method="post"
action="body_mail_merge.php">
<p><label for="name">Name: </label>
<input type="text" name="name" id="name" /></p>
<p><label for="email">Email: </label>
<input type="text" name="email" id="email" /></p>
<p><input type="reset" name="reset" value="reset" />
<input type="submit" name="submit" value="submit" /></p>
</form>
</body>
</html>
<?php
if (isset($_POST["submit"])) {
$name = $_POST["name"];
$email = $_POST["email"];
//fp = file pointer
$fp = fopen("maillist.dat", "a+");
//puts body (email list) into file mailist.dat
fputs($fp, $name, $email);
//closes connection to file used.
fclose($fp);
Print"The mail list has been created for your SPAM. \"mailist.dat\"";
}
?>
body_mail_merge.php:
<html>
<body>
<p>Spam Body Page</p>
<form action="mailmerge.php" method="POST" name="form1" >
Spam Message:<br />
<textarea name="message" value="message" rows="15" cols="40">
</textarea><br />
<input type="Submit" />
</form>
</body>
</html>
<?php
if (isset($_POST["Submit"])) {
$body = $_POST["message"];
//this creates a file pointer to the new file with write permissions.
$fp = fopen("spamBody.txt", "a+");
//creates file in the folder
fputs($fp, $body);
//close file pointer
fclose($fp);
print"The body has been created for your SPAM. File name:spamBody.txt";
}
?>
mailmerge.php:
<html>
<body>
<p>Here is what your SPAM message will look like:</p>
<?php
$theData = file("maillist.dat");
$theBody = file("spamBody.txt");
$message = <<<HERE
Email: $theBody
<br>
<br>
Spam Body: $theData
<br>
<br>
Sincerely,
<br>
<br>
BG Spammer
HERE;
print"$message";
?>
<p>Return to the <a href="maillist.php">Main Page</a>.</p>
</body>
</html>