Jump to content

I need help with my contact form! Im getting unknown sender when the form sends!


isiah

Recommended Posts

Ok now im not sure exactly whats wrong here i know it works by 2 files one is the send_contact.php and the other is a java script. I had a guy make me a website and I haven't been able to get a hold of him to fix it. So im seeking help in the phpfreaks. Could someone please take a look at it and tell what i need to fix i would reall appreciate it.

 

Here is the JavaScript

 

function clearFields() {

$('form#form_contact input, form#form_contact textarea').focus(function(){

if ($(this).attr('rel') != 'cleared') {

$(this).val('').attr('rel', 'cleared');

}

});

$('form#form_contact input, form#form_contact textarea').blur(function(){

if($(this).val() == ""){

$(this).val(this.defaultValue).attr('rel', '');

 

}

});

}

function verifyErrors() {

var ready = 1;

$('.required_field').css('color', '#6b6b6b');

$('.required_field').each(function(){

if(($(this).val() == "")||(!$(this).attr('rel'))) {

$(this).css('color', '#d6041f');

ready = 0;

}

});

$('input.email').each(function(){

var email_val = $(this).val();

if(email_val.indexOf('@') < 0) {

$(this).css('color', '#d6041f');

ready = 0;

}

});

$('input.security').each(function(){

if($(this).val() != "4") {

$(this).css('color', '#d6041f');

ready = 0;

}

});

if (ready == 0) {

$('p.warning').text('* Please fill out the boxes highlighted in red and click submit').css('color', '#d6041f');

return false;

};

return true;

}

function formControl() {

$('form#form_contact').submit(function(){

if (verifyErrors()) {

action = $(this).attr('action');

mesagetosend = $(this).serialize();

$.ajax({

type: "POST",

url: 'send_contact.php',

data: mesagetosend,

dataType : "html",

timeout:10000,

error: function() {

replaceContent();

},

success: function(msg){

replaceContent();

}

});

}

return false;

});

}

function replaceContent() {

$('div#contact').replaceWith('<div id="thank_you" class="ajax"><h2><strong>Thank You</strong><em>We appreciate your inquiry,<br />and will respond as soon as possible</em></h2></div>');

}

jQuery(function($) {

clearFields();

formControl();

});

Here is the form

<form id="form_contact" method="post" action="">

<div class="left_column quick quick_left">

<h2 class="quick">Quick Contact</h2>

<p class="warning">* Means the box must be filled in before sending</p>

<div class="form_entry_input">

<label>* Your Name</label>

<input type="text" name="f_name" id="f_name" value="* Your Name" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Business Name</label>

<input type="text" name="f_business" id="f_business" value="* Business Name" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Your Email</label>

<input type="text" name="f_email" id="f_email" value="* Your Email" class="email required_field" />

</div>

<div class="form_entry_input">

<label>* Phone Number</label>

<input type="text" name="f_phone" id="f_phone" value="* Phone Number" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Comments</label>

<textarea name="f_comment" id="f_comment" rows="7" cols="40" class="required_field">* Comments and Questions</textarea>

</div>

<button type="submit" class="submit">Submit</button>

Here the send_contact.php

<?php

 

$mail_from="$f_name";

$business="$f_business";

$email="$f_email";

$phone="$f_phone";

$comment="$f_comment";

 

// From

$header="from: $name <$mail_from>";

 

// Contact phone

$phone ="$phone";

 

// Message

$message="$message";

 

 

// Enter your email address

$to ='isiahb.strong@gmail.com';

 

$send_contact=mail($to,$phone,$message,$header);

 

// Check, if message sent to your email

// display message "We've recived your information"

if($send_contact){

 

 

echo "We've recived your contact information";

 

}

else {

echo "ERROR";

}

?>

 

Thanks to anyone who can help me out i really appreciate it!!

Link to comment
Share on other sites

Thats the most godawful code I have seen for a contact form. There is not even any validation. I could send an email with html tags and unlimited characters for example. Is there even captcha on it?

Lastly using echo "error" for any error is really just bad. The variables they did fill out should be returned to the form along with the error details. Thats just awful. I would consider finding a new programmer for hire and I wouldn't use that script. (well techically I would just make my own. :P )

Link to comment
Share on other sites

Oh thanks for your response but i accidentaly left some of the code out of the form.

 

<form id="form_contact" method="post" action="">

<div class="left_column quick quick_left">

<h2 class="quick">Quick Contact</h2>

 

<p class="warning">* Means the box must be filled in before sending</p>

<div class="form_entry_input">

<label>* Your Name</label>

<input type="text" name="f_name" id="f_name" value="* Your Name" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Business Name</label>

 

<input type="text" name="f_business" id="f_business" value="* Business Name" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Your Email</label>

<input type="text" name="f_email" id="f_email" value="* Your Email" class="email required_field" />

</div>

<div class="form_entry_input">

<label>* Phone Number</label>

 

<input type="text" name="f_phone" id="f_phone" value="* Phone Number" class="required_field" />

</div>

<div class="form_entry_input">

<label>* Comments</label>

<textarea name="f_comment" id="f_comment" rows="7" cols="40" class="required_field">* Comments and Questions</textarea>

</div>

<div class="form_entry_input">

<label class="security">2 + 2 = </label>

<input class="security required_field" name="f_security" id="f_security" type="text" value="Type your answer to the security question at left here." />

</div>

<button type="submit" class="submit">Submit</button>

</div>

</div>

</form>

 

some was snipped off of the bottom part. could you please reassess it and tell me if there is anything i could do thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.