Hi
I've been using this adapted contact form for a number of years on my server without problems, but now it's throwing up error messages on a different server:
Notice: Undefined variable: REMOTE_ADDR in C:\websites\LocalUser\ictspaghetti.com\public_html\CAD\contactformab.php on line 37
Notice: Undefined variable: REMOTE_ADDR in C:\websites\LocalUser\ictspaghetti.com\public_html\CAD\contactformab.php on line 39
Notice: Undefined variable: action in C:\websites\LocalUser\ictspaghetti.com\public_html\CAD\contactformab.php on line 42
I'm afraid I've no idea what this means or how to fix it. Any idea what I can do?
Here's the contact form code:
<?
// Enter your email address here
$adminaddress = "webenquiry@abisti.co.uk";
// Enter the address of your website here MUST include http://www.
$siteaddress ="http://www.abisti.co.uk";
// Enter your company name or site name here
$sitename = "Abisti Web Design";
// Enter your page title here
$ptitle = "Contact Form ";
// Colour/Style Values for your page - hexy!
//Background Colour
$bgcolor = "#FFFFFF";
//Table Border
$bocolor = "#FFFFFF";
// Font Colour
$fcolor = "#000099";
// Link Colour
$lcolor = "#0000ff";
// Font Style
$font = "verdana";
// Font Size
$fontsize = "3";
// Unless you know better I advise that you don't touch anything below here!
// Don't touch this it grabs the date and time from your server
$date = date("m/d/Y H:i:s");
$vers = "VinceMail V1.1";
$traceroute = "<a href=\"http://www.above.net/cgi-bin/trace?$REMOTE_ADDR\">";
if ($REMOTE_ADDR == "") $ip = "<i> no ip </i>";
else $ip = getHostByAddr($REMOTE_ADDR);
IF ($action==""):
?> <br />
<FORM name=validation METHOD=POST ACTION="<? echo "$PHP_SELF"; ?>" onSubmit="return checkbae()">
<table border="0" cellspacing="0" cellpadding="2" width="90%">
<tr>
<td valign="TOP">
<center>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<td valign="TOP" colspan=2><span class="strong"><? echo "$ptitle"; ?><br />
</span>
<p align="left"> </p>
</td>
</tr>
<tr>
<td valign="TOP" width="38%">Your
First Name:</td>
<td valign="TOP" width="62%">
<input type="text" name="fname" size="40" class="formbox" >
</td>
</tr>
<tr>
<td valign="TOP" width="38%">Your
Last Name:</td>
<td valign="TOP" width="62%">
<input type="text" name="lname" size="40" class="formbox" >
</td>
</tr>
<tr>
<td valign="TOP" width="38%">Your
Email:</td>
<td valign="TOP" width="62%">
<input type="text" name="vemail" size="40" class="formbox" >
</td>
</tr>
<tr>
<td valign="TOP" width="38%">Company
Name:</td>
<td valign="TOP" width="62%">
<input type="text" name="cname" size="40" class="formbox" >
</td>
</tr>
<tr>
<td valign="TOP" width="38%">Tel
no:</td>
<td valign="TOP" width="62%">
<input type="text" name="telno" size="40" class="formbox" >
</td>
</tr>
<tr>
<td valign="TOP" height="34">How
did you find out about Abisti?</td>
<td valign="middle" height="34">
<select name="refer">
<option value="Rec">Please specify...</option>
<option value="Rec">Recommendation</option>
<option value="Google">Google</option>
<option value="UKWDA">UK Web Designers Association</option>
<option value="YP">Yellow Pages</option>
<option value="Yell">Yell.Com</option>
<option value="BT Book">BT Phonebook</option>
<option value="Other SE">Other Search Engine</option>
<option value="Other Ad">Other Advertising</option>
<option value="Link">Link from Abisti Designed Site</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td valign="TOP" colspan="2"><font face="<? echo "$font"; ?>" size="<? echo "$fontsize"; ?>" color="<? echo "$fcolor"; ?>">Additional
Comments:</td>
</tr>
<tr>
<td valign="TOP" colspan="2">
<textarea name="comments" rows="10" cols="40" class="textformbox" ></textarea>
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit" name="action" value="Send" class="sendbutton">
<input type="reset" name="Reset" value="Reset" class="sendbutton">
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
<script type="text/javascript">
var testresults
function checkemail(){
var str=document.validation.vemail.value
var filter=/^.+@.+\..{2,3}$/
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
</script>
<script>
function checkbae(){
if (document.layers||document.all)
return checkemail()
else
return true
}
</script>
<?
//This grabs the form data and formats it and sends it in an email to you
ELSEIF ($action="Send"):
mail("$adminaddress","Info Request", "FAO: Admin @ $sitename \n
First Name: $fname
Last Name: $lname
Email: $vemail
Company: $cname
Telephone: $telno
Referrer: $refer\n
The visitor commented:
------------------------------
$comments
------------------------------
Logged Info :
------------------------------
Mailer: $vers
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress");
//This grabs the form data and sends a confirmation to your visitor
mail("$vemail","Thank You for visiting $sitename", "Hi $fname,\n
Thank you for your interest in $sitename!
We will read your comments as soon as we can and act accordingly.
You can expect a response within 48hrs.\n
Best regards,
$sitename
$siteaddress","FROM:$adminaddress");
PRINT "<p>Hello, $fname.";
PRINT "<br /><br />";
PRINT "Thank you for your completing our form.<br /><br />";
PRINT "We will respond to $vemail , as soon as possible.<br /></p>";
ENDIF;
?>
</form>
[PHP tags added by moderator - bpat1434]