I have a php page developed to gather first name, last name and email addresses and need to add an "OPT-IN" radio button.
I want this button to send the already entered information into another text file.
Below is my php code for my register page and my thank you page. Any help would be great....
REGISTER FORM INFO
<form action="./emaillist.php" method="POST">
<p align="left"><span class="style3"> First Name:
<input name="fname" type="text">
<br>
Last Name:
<input name="lname" type="text">
<br>
Email Add:</span>
<input type="text" name="email">
<br>
<input type=submit>
</p>
</form>
THANK YOU PAGE PHP
<?php
$filename = 'final/emails.txt';
$fname=$POST[fname];
$lname=$POST[lname];
$email=$_POST[email];
$entry = $fname . " " . $lname . " " . $email . "\n";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $entry) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "<font face=verdana size=3 color=990000>"; echo "Thank you for entering the contest,<br>winners will be notified via email in 2 weeks";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>