malfunction of contact form

0 replies
  • WEB DESIGN
  • |
I am not sure this is the right place for my post since I know nothing about webdesign.

I has a website, which is very simple and works well except the contact form, I experienced a lot of spam because it seems the validation of form is not functioning well.

I tested it myself, the validation works well under windows XP, I am not sure for other browser, this is some code I got from website so I really don't know where is the problems.

below is the PHP part of the contact form

<body>
<?php
$field_firstname = $_POST['firstname'];" ".$_POST['lastname'];
$field_emailaddress= $_POST['emailaddress'];
$field_telepohone = $_POST['telephone'];
$field_country = $_POST['country'];
$field_business = $_POST['business'];
$field_comments = $_POST['comments'];

$mail_to = 'info@abc.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message .= 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$_POST['emailaddress']."\n";
$body_message .= 'Message: \n'.$_POST['emailaddress']."\n";
$body_message .= $_POST['telephone']."\n";
$body_message .= $_POST['country']."\n";
$body_message .= $_POST['business']."\n";
$body_message .= $_POST['comments'];

$headers = 'From: '.$_POST['emailaddress'].'\r\n';
$headers = 'Reply-To: '.$_POST['emailaddress'].'\r\n';

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');

<!--
window.location.href = "http://www.abc.com/index.html";
//-->

</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please check the items required');

<!--
window.location.href = "http://www.zooqc.com/contact.html";
//-->

</script>
<?php
}
?>
</body>
</html>


below is the Dreamweaver part of contact from

<div id="formplace">
<form action="contact.php" method="post" name="formplace" target="_blank" class="email" id="formplace" onsubmit="MM_validateForm('firstname','','R','last name','','R','emailaddress','','NisEmail','comment s','','R');return document.MM_returnValue">
You could also fill in below form and send it to us. we will get back to you as soon as possible.<br /><br />
First name: <input name="firstname" type="text" id="firstname" style="height:13px ; position:absolute; left:110px;" maxlength="25" /><br /><br />

Last name: <input name="lastname" type="text" id="lastname" style="height:13px ; position:absolute; left:110px;" maxlength="25" /><br /><br />

Email Address: <input name="emailaddress" type="text" id="emailaddress" style="height:13px ; position:absolute; left:110px;" maxlength="25" /><br /><br />

Telephone: <input name="telephone" type="text" id="telephone" style="height:13px ; position:absolute; left:110px;" maxlength="25" /><br /><br />

Country: <select name="country"style="height:20px ; position:absolute; left:110px;">
<option>Australia</option>
<option>Austria</option>
<option>Belgium</option>
<option>Czech Republic</option>
<option>Denmark</option>
<option>Finland</option>
<option>France</option>
<option>Germany</option>
<option>Greece</option>
<option>Hungary</option>
<option>Italy</option>
<option>Netherlands</option>
<option>Norway</option>
<option>Poland</option>
<option>Romania</option>
<option>Russia</option>
<option>Spain</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>United Kingdom</option>
<option>Canada</option>
<option>Mexico</option>
<option>United States of America</option>
<option>Argentina</option>
<option>Brazil</option>
<option>New Zealand</option>
<option>Egypt</option>
<option>Iran</option>
<option>Israel</option>
<option>Kuwait</option>
<option>Saudi Arabia</option>
<option>Turkey</option>
<option>Japan</option>
<option>South Korea</option>
<option>Vietnam</option>
<option>other</option>
</select><br /><br />

Business:<select name="business"style="height:20px ; position:absolute; left:110px;">
<option>wholesale</option>
<option>retail</option>
<option>industrial</option>
<option>services</option>
<option>distributor</option>
<option>manufacturer</option>
<option>importer</option>
<option>other</option>
</select><br /><br />

Comments:<textarea name="comments" style="position:absolute; left:110px; height:150px; width:330px;" cols="38" rows="5" id="comments"></textarea><br />
<br />

<input name="submit" type="submit" id="submit" style="position:absolute; left:110px; bottom:20px;" onclick="MM_validateForm('firstname','','R','lastn ame','','R','emailaddress','','RisEmail','telephon e','','NisNum','comments','','R');return document.MM_returnValue" value="Submit" />
<br />
</p>
</form>
</div>


pls kindly hekp me with this, which is very important to me to apply something. thank you
#contact #form #malfunction #php

Trending Topics