I use a php script to read variables from a form and write them to an html file. I have a minor problem with the script .... it comments out apostropes when writing to the target html file (ex. don\'t ). Can you help fix this problem?
Also, I would like to read the poster's IP address and write it to the file as well. Below is my current script. I would greatly appreciate it if someone could post the necessary changes to solve my two requests. Thank you in advance.
<?
// Configure this script using the following variables ...
$email = "me@mydomain.com";
$subject = "Form Results";
$filename = "/results/thisform.html";
$redirect = "/thanx/thisform.html";
// ------------------------------------------------------------
$fd = fopen($filename, "a");
fputs($fd, "<UL>\n");
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$msg .= " $key: $val\n";
fputs($fd, "<LI><B>$key</B>: $val<BR>\n");
}
$date = date("F j, Y g:i a");
$msg .= "\n$date\n";
mail($email, $subject, $msg);
fputs($fd, "</UL><BR>$date<HR>\n");
fclose($fd);
header("Location: $redirect");
?>