Hi
I've done this but am still getting the following message:
Notice: Undefined index: action in C:\websites\LocalUser\ictspaghetti.com\public_html\CAD\contactformab2.php on line 42
<?php
// 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?'.$_SERVER['REMOTE_ADDR'].'">';
if ($_SERVER['REMOTE_ADDR'] == '') $ip = '<i> no ip </i>';
else $ip = getHostByAddr($_SERVER['REMOTE_ADDR']);
IF ($_POST['action']==''){
?> <br />
<form name="validation" method="post" action="<?php echo $_SERVER['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"><?php 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="<?php echo $font; ?>" size="<?php echo $fontsize; ?>" color="<?php 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="hidden" name="action" value="Send" />
<input type="submit" name="submit" 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)
}
function checkbae(){
if (document.layers||document.all)
return checkemail()
else
return true
}
</script>
<?php
}
//This grabs the form data and formats it and sends it in an email to you
ELSEIF ($_POST['action']=='Send') {
$message = sprintf('FAO: Admin @ %s
First Name: %s
Last Name: %s
Email: %s
Company: %s
Telephone: %s
Referrer: %s
The visitor commented:
------------------------------
%s
------------------------------
Logged Info :
------------------------------
Mailer: %s
Using: %s
Hostname: %s
IP address: %s
Date/Time: %s', $adminaddress, $_POST['fname'], $_POST['lname'], $_POST['vemail'],
$_POST['cname'], $_POST['telno'], $_POST['refer'], $_POST['comments'], $vers,
$_SERVER['HTTP_USER_AGENT'], $ip, $date);
$tymessage = sprintf('Hi %2$s,
Thank you for your interest in %1$s!
We will read your comments as soon as we can and act accordingly.
You can expect a response within 48hrs.
Best regards,
%1$s
%3$s', $sitename, $_POST['fname'], $adminaddress);
//This grabs the form data and sends a confirmation to your visitor
mail($adminaddress,'Info Request', $message, 'FROM:'.$adminaddress);
mail($_POST['vemail'],'Thank You for visiting '.$sitename, $tymessage,'FROM:'.$adminaddress);
echo '<p>Hello, ' . $_POST['fname'] . '<br /><br />
Thank you for your completing our form.<br /><br />
We will respond to ' . $_POST['vemail'] . ', as soon as possible.<br /></p>';
}
?>
</form>