I was wondering if you might be able to assist me with the following PHP problem. My ISP recently upgraded their version of PHP from 4 to PHP 5.1.4 (cli) (built: May 11 2006 08:44:46) and my PHP email form nolonger works. The relevant HTML and PHP code are as shown below:
HTML Code:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Personal Email Form</title></head>
<body BACKGROUND="yellow_r.jpg" BGCOLOR="#ffffff">
<script language="javascript">
function makeArray() {
var args = makeArray.arguments;
for (var i = 0; i < args.length; i++) {
this = args;
}
this.length = args.length;
}
var months = new makeArray("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var lastmod = "";
var lmdate = new Date(document.lastModified);
var time = new Date();
var lmonth = months[lmdate.getMonth()];
lastmod = "" + ((lmdate.getDate() < 10) ? ("0" + lmdate.getDate()) : (lmdate.getDate()));
lastmod += "-" + months[lmdate.getMonth()] + "-";
AsAt = lastmod
year = lmdate.getYear();
year %= 100;
year = ((year < 50) ? (2000 + year) : (1900 + year));
Hours = lmdate.getHours();
Mins = lmdate.getMinutes();
Secs = lmdate.getSeconds();
Hours = ((Hours < 10) ? ("0" + Hours) : (Hours));
Mins = ((Mins < 10) ? ("0" + Mins) : (Mins));
Secs = ((Secs < 10) ? ("0" + Secs) : (Secs));
lastmod += year + " @ " + Hours + ":" + Mins + ":" + Secs;
AsAt += year
</script>
<script>document.write("This page was last modified on " + lastmod)</script>
<hr size=4 noshade>
<h1>Personal Email Form</h1>
To send me an email message, please enter your name, email address and your comments, etc, in the boxes below.<br> When you're finished, select <b>Send Mail</b> at the bottom of this page.<br> To blank out your message, select <b>Clear Form</b>.<br> Your responses to the radio button questions below, while not required, would be interesting.<br> Any request or question below displaying a default response <b>is mandatory</b>.
<!-- form action="http://www.tip.net.au/cgi-bin/cgiwrap/~pmyers/FormMail.pl" method="post" -->
<form action="PRM_sendmail.php" method="post">
<hr size=6 noshade><em>Please enter your name and email address in the respective spaces below. Please ensure that your <b>email address</b> is <b>correct</b> if you want to receive a reply.</em>
<pre>
Your Name: <input name="realname" size=40>
Your Email Address: <input name="email" size=40>
</pre>
<em>Please enter any comments, etc, for me in the space below.</em>
<p><textarea wrap=soft name="Feedback" rows=10 cols=75></textarea>
<!-- p><em>To which of my email addresses is this message to be directed (all of the email addresses below are 'live'):</em>
<p>
<ol>
<li><INPUT type=radio name="recipient" value="prmyers@acslink.net.au" checked> prmyers@acslink.net.au - General [points to my Personal email address]<br>
</ol -->
<INPUT type=hidden name="recipient" value="prmyers@acslink.net.au">
<p>
<em>What colour background do you want used for the 'Thank You' screen. The default suggested below is the same as the background to this screen:</em>
<p>
<SELECT name="background" size=6>
<OPTION value="lightblue.jpg"> Light Blue
<OPTION value="lightgreen.jpg"> Light Green
<OPTION value="purple.jpg"> Purple
<OPTION value="red.jpg"> Red
<OPTION value="yellow.jpg"> Yellow
<OPTION SELECTED value="yellow_r.jpg"> Yellow-R
</SELECT>
<p><p>
<input type="submit" value="Send Mail">
<input type="reset" value="Clear Form">
<input type="button" value="Previous Page" onclick="history.go(-1)">
<input type=hidden name="bgcolor" value="#ffffff">
<input type=hidden name="subject" value="Email Message to Paul Myers">
<input type=hidden name="title" value="Thank You For Your Email Message">
</form>
<hr size=6 noshade>
<address><script>document.write("This page was last modified on " + lastmod)</script><br>
Modifications to this page © 1998-2003, Paul Myers</address>
</body>
</html>
PHP Code
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title><?= $title ?></title>
</head>
<body BACKGROUND="<?= $background ?>" BGCOLOR="#ffffff">
<!-- hr size=4 noshade -->
<?php
$dateTime = date("d-m-Y H:i:s", time());
$mailmsg = "Email From.... :\t$realname\n";
$mailmsg .= "Reply-To...... :\t$email\n";
$mailmsg .= "Sent At....... :\t$dateTime\n";
$mailmsg .= "Subject....... :\t$subject\n";
$mailmsg .= "Message....... :\t$Feedback\n\n";
$mailmsgL1 = "Email From.... :\t$realname\n";
$mailmsgL2 = "Reply-To...... :\t$email\n";
$mailmsgL3 = "Sent At....... :\t$dateTime\n";
$mailmsgL4 = "Subject....... :\t$subject\n";
$mailmsgL8 = "Message....... :\t$Feedback\n\n";
$recipient = "$recipient";
$subject = "$subject";
$mailheaders = "From: $realname <$email> \n";
// $mailheaders .= "Reply-To: $email\n\n";
// mail( "to", "subject", "message"[, "additional_headers"[, "additional_parameters"]])
mail($recipient, $subject, $mailmsg, $mailheaders);
?>
<div align="center">
<table border="1" cellspacing="0" cellpadding="1" width=700>
<tr bgcolor=555533><td><font color="#FFFFFF"><b><div align="center">Email Sent at <?= $dateTime ?></div></b></font></td></tr>
<tr>
<td><!-- div align="center" -->
<br>
Thank you for your message to the me, <?= $realname ?><p>
<!-- br><br --><!-- /div -->
Your message was as follows:<p>
<!-- br><br -->
<?= $mailmsgL1 ?><br>
<?= $mailmsgL2 ?><br>
<?= $mailmsgL3 ?><br>
<?= $mailmsgL4 ?><br>
<?= $mailmsgL8 ?>
<br><br>
<!-- /div --></td>
</tr>
</table></div>
<p><p>
<form>
<input type="button" value="Back to Previous Page" onclick="history.go(-1)">
</form>
<hr size=4 noshade>
<address>Modifications to this page © 1998-2002, Paul Myers</address><p>
</body>
</html>
I would be most grateful for any assistance you might be able to provide which will enable me to get this code up and working again. Thank you.
If you would like to test the existing version, the URL for the email form (code shown above) is "http://www.tip.net.au/~pmyers/PRMyersEF.htm".
I look forward to hearing back from you soon and thank you for your assistance in this matter.
Regards,
Paul Myers