i got a contact.php code but its not working here is my html code and the contact.php code can you tell me what i have done wrong please
html code
Code:
<form id="form1" name="advertising" method="post" action="contact.php">
<table width="100%" align="center">
<tr>
<td width="92">Name</td>
<td width="158"><label>
<input name="name" type="text" id="name" size="45" maxlength="45" />
</label></td>
</tr>
<tr>
<td>Company Name</td>
<td><label>
<input name="company" type="text" id="company" size="45" maxlength="45" />
</label></td>
</tr>
<tr>
<td>Email Address</td>
<td><label>
<input name="email" type="text" id="email" size="45" maxlength="45" />
</label></td>
</tr>
<tr>
<td><p>Banner Option</p> </td>
<td><label>
<select name="options" class="text2" id="options">
<option>Text Links</option>
<option>Banners</option>
<option>Bannerrrs</option>
<option>Bannnerss</option>
</select>
</label></td>
</tr>
<tr>
<td> Comments</td>
<td><label>
<textarea name="message" id="message" cols="57" rows="11"></textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input name="button" type="submit" class="inputstyle" id="button" onclick="MM_validateForm('name','','R','company','','R','email','','RisEmail','message','','R');return document.MM_returnValue" value="Send" />
</label>
<label>
<input name="button2" type="reset" class="inputstyle" id="button2" value="Clear" />
</label></td>
</tr>
</table>
</form>
contact.php
Code:
<?php
// Custom variables - Edit these to meet your needs
$email = "my@mydomain.com";
$message = "You have been sent an e-mail via your contact form by [EMAIL]
--------------------------------
[MESSAGE]
--------------------------------"; /* The e-mail structure you will receive. Every occurrence of [EMAIL] will be replaced by
the user's e-mail address and every occurrence of [MESSAGE] will be replaced by the user's message to you */
$subject = "E-mail from Contact Form: [SUBJECT]" /* The subject line of all e-mails sent to you via this script. Every
occurrence of [SUBJECT] will be replaced by the user's subject. */
// No more configuration variables beyond this point
if ( $_POST['Send'] )
{
// Make sure all fields have been filled in
$errors = array();
if ( ! $_POST['name'] )
{
$errors[] = "You must enter your name in the field provided.";
}
if ( ! $_POST['company'] )
{
$errors[] = "You must enter your company name in the field provided.";
}
if ( ! $_POST['email'] )
{
$errors[] = "You must enter your e-mail address in the field provided.";
}
if ( ! $_POST['option'] )
{
$errors[] = "Please select a option from the drop-down list provided.";
}
if ( ! $_POST['message'] )
{
$errors[] = "You must enter a message to send.";
}
if ( count( $errors ) > 0 )
{
print "The following errors have occurred with your contact form:<br /><br />\r\n";
foreach ( $errors as $msg )
{
print "- {$msg}<br />\r\n";
}
print "Please <a href=\"java script:history.back()\">Return</a> and fix these problems.
}
else
{
$name = $_POST['name'];
$name = str_replace( '[NAME]', $_POST['name'], $name );
$company = $_POST['company'];
$campany = str_replace( '[COMPANY]', $_POST['company'], $company );
$option = $_POST['option'];
$option = str_replace( '[OPTION]', $_POST['option'], $option );
$message = $_POST['message'];
$message = str_replace( '[MESSAGE]', $_POST['message'], $message );
$message = str_replace( '[EMAIL]', $_POST['email'], $message );
if ( @mail( $_POST['email'], $_POST['name'], $_POST['company'], $_POST['option'], $_POST['message'], "From: {$email}" ) )
{
print "Your e-mail has been sent successfully.";
}
else
{
print "There seems to be a problem with sending your e-mail. Please try again at a later time.";
}
}
}
Bookmarks