Ramui forum script
Home :: Ramui forum script :: Contact Form code and modifications :: modifying auto responder form
Select Style:
User:
User:
Password:
Keep me login in this computer

modifying auto responder form

Hi i have a question about your AJAX form. I have added 2 fields to the form. when i click on the send message button, the email gets sent. But when i receive the email i only receive name/subject/message and ip address and date. as below

================================================
Message from: user@taylorslakesonline.com.au

I.P.: 203.170.136.144

Date: 18.08.2009 18:01

0412598698
================================================
The 2 extra fields that I have added, are not being sent in the email.
How do I fix this ? i have added them as mandatory...  Is it in the mail.js file? What do i need to edit. thanks.
Posted by: tay18598;   Post:1;   Comments:0;  Date of Join: Aug 20, 2009, 08:39
Post date: Aug 20, 2009, 08:44
New topicReplyContactReport

Re: modifying auto responder form

Actually you have to change three files. First change your contact form (HTML or PHP) file to add fields.
Code
<tr>
<td>field_1:</td>
<td><input name="field_1" type="text" id="fw_contact_field_1" class="text" style="width:200px;" /></td>
</tr>
<tr>
<td>field_2:</td>
<td><input name=" field_2" type="text" id="fw_contact_ field_2" class="text" style="width:200px;" /></td>
</tr>
Now open "mail/script/mail.js". Find the string in function fw_mail():

var params = "name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(
document.getElementById('fw_contact_subject').value) + "&message=" +fw_total_encode(document.getElementById('fw_contact_message').value) + "&captcha_code=" + fw_total_encode(
document.getElementById('fw_contact_captcha').value);


Add after:
Code
params+ = "&field_1=" + fw_total_encode(document.getElementById('fw_contact_field_1').value )+ "&field_2=" + fw_total_encode(document.getElementById('fw_contact_field_2').value);
Now open file "mail/index.php". At line-366 under function send_mail() find text:

$msg='Message from: '.$name."\n\n".'I.P.: '.($_SERVER['REMOTE_ADDR'])."\n\n".'Date: '.date('d.m.Y H:i')."\n\n".$message;


Replace it with the following lines of code:
Code
$field_1 = rawurldecode($_POST["field_1"]);
$field_2 = rawurldecode($_POST["field_2"]);
$msg='Message from: '.$name."\n\n".'I.P.: '.($_SERVER['REMOTE_ADDR'])."\n\n".'Date: '.date('d.m.Y H:i'). "\n\nfield_1: $field_1 \n\nfield_2: $field_2\n\n".$message;
Please replace every occurrence of field_1 and field_2 with actual field name. After modifications, if you find any problem please put your code here.

-----------------------------------------------------------
Web hosting directory

Posted by: admin;   Post:34;   Comments:116;  Date of Join: Nov 05, 2008, 08:04
Post date: Aug 20, 2009, 12:18
ContactReport

Re: modifying auto responder form

Hi i have follwed your code from the above examples, however i am having an issue. i have added 1 new field ( phone number)
however when i receive an email there is no data being collected and the time is incorrect by 3 hours
=====================================================
Message from: example

I.P.: 110.32.153.220

Date: 27.11.2010 11:38

Phone Number:

this email is a test
======================================================
"mail/script/mail.js". Find the string in function fw_mail():

my code
--------------------------------------------------------------------------------
var url = "mail/index.php?sendmail=true";
var params = "&phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(
document.getElementById('fw_contact_subject').value) + "&phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&field_2=" + fw_total_encode(document.getElementById('fw_contact_field_2').value);
+ "&message=" +fw_total_encode(document.getElementById('fw_contact_message').value) + "&captcha_code=" + fw_total_encode(
document.getElementById('fw_contact_captcha').value);
===================================================
index.php my code

$subject = $this->strip_slashes(rawurldecode($_POST["subject"]));
if (empty($subject)){ $subject="none";}
$message = $this->strip_slashes(rawurldecode($_POST["message"]));
$message=$this->remove_smarttag($message);
$from = $this->strip_slashes(rawurldecode($_POST["from"]));
$name = $this->strip_slashes(rawurldecode($_POST["name"]));
$phone = rawurldecode($_POST["phone"]);

$msg='Message from: '.$name."\n\n".'I.P.: '.($_SERVER['REMOTE_ADDR'])."\n\n".'Date: '.date('d.m.Y H:i'). "\n\nPhone Number: $Phone\n\n".$message;

----------------------------------------------------------------------------------------


thanks please advise....
Posted by: fgiurleo;   Post:0;   Comments:4;  Date of Join: Nov 25, 2010, 09:55
Post date: Nov 27, 2010, 04:11
ContactReport

Re: modifying auto responder form

Hello,
Use the following code for "mail/script/mail.js"
Code
var url = "mail/index.php?sendmail=true";
var params = "phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(
document.getElementById('fw_contact_subject').value) + "&phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&field_2=" + fw_total_encode(document.getElementById('fw_contact_field_2').value);
+ "&message=" +fw_total_encode(document.getElementById('fw_contact_message').value) + "&captcha_code=" + fw_total_encode(
document.getElementById('fw_contact_captcha').value); 
Your mistake is:
You should use first term of a query string (phone in above case) normal and then add every other terms (e.g. name, subject, etc.) with '&'.
-----------------------------
Please give me feedback.

-----------------------------------------------------------
Web hosting directory

Posted by: admin;   Post:34;   Comments:116;  Date of Join: Nov 05, 2008, 08:04
Post date: Nov 27, 2010, 14:43
ContactReport

Re: modifying auto responder form

when i click send on form nothing happens....

http://www.premiermortgages.com.au/contact-us-form.html

see for your self
--------------------------------------------------------------------------------

var url = "mail/index.php?sendmail=true";
var params = "phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(
document.getElementById('fw_contact_subject').value) + "&phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&field_2=" + fw_total_encode(document.getElementById('fw_contact_field_2').value);
+ "&message=" +fw_total_encode(document.getElementById('fw_contact_message').value) + "&captcha_code=" + fw_total_encode(
document.getElementById('fw_contact_captcha').value);


===================================================

private function send_mail()
{
if(!(bin2hex($_SESSION['captcha_code']) == bin2hex($_POST['captcha_code']) && !empty($_SESSION['captcha_code'] ))){
echo '<span style="color: #660033; font-size: 12px; font-weight: 600;"><img style="border:none;" src="mail/images/fail.gif">Error! wrong verification code. Please try again.</span>';
exit;}

$subject = $this->strip_slashes(rawurldecode($_POST["subject"]));
if (empty($subject)){ $subject="none";}
$message = $this->strip_slashes(rawurldecode($_POST["message"]));
$message=$this->remove_smarttag($message);
$from = $this->strip_slashes(rawurldecode($_POST["from"]));
$name = $this->strip_slashes(rawurldecode($_POST["name"]));
$phone = rawurldecode($_POST["phone"]);

$msg='Message from: '.$name."\n\n".'I.P.: '.($_SERVER['REMOTE_ADDR'])."\n\n".'Date: '.date('d.m.Y H:i'). "\n\nPhone Number: $Phone\n\n".$message;
Posted by: fgiurleo;   Post:0;   Comments:4;  Date of Join: Nov 25, 2010, 09:55
Post date: Nov 28, 2010, 11:12
ContactReport

Re: modifying auto responder form

Hello,
Sorry you have done wrong again. Your correct JavaScript code is as follows. You just download the following attachment (zip file), uncompressed it and replace it with your mail.js.
[attachment=0]mail.zip[/attachment]
Code
var params = "phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(document.getElementById('fw_contact_subject').value) + "&message=" + fw_total_encode(document.getElementById('fw_contact_message').value ) + "&captcha_code=" + fw_total_encode(document.getElementById('fw_contact_captcha').value);

-----------------------------------------------------------
Web hosting directory

Posted by: admin;   Post:34;   Comments:116;  Date of Join: Nov 05, 2008, 08:04
Post date: Nov 28, 2010, 14:44
ContactReport

Re: modifying auto responder form

Hi i have tried this, and still the same thing. do you have an email address and i can send u my attachments?
Posted by: fgiurleo;   Post:0;   Comments:4;  Date of Join: Nov 25, 2010, 09:55
Post date: Nov 29, 2010, 00:49
ContactReport

Re: modifying auto responder form

Hello,
I can't understand why you do not replace your mail.js file with the attachment? I verify your mail.js file. The code you use:

var params = "phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&name=" + fw_total_encode(document.getElementById('fw_contact_name').value) + "&from=" +fw_total_encode(document.getElementById('fw_contact_from').value) +"&subject=" + fw_total_encode(
document.getElementById('fw_contact_subject').value) + "&phone=" + fw_total_encode(document.getElementById('fw_contact_phone').value ) + "&field_2=" + fw_total_encode(document.getElementById('fw_contact_field_2').value);
+ "&message=" +fw_total_encode(document.getElementById('fw_contact_message').value) + "&captcha_code=" + fw_total_encode(
document.getElementById('fw_contact_captcha').value);

There are three lines of code. Remove the red part from your code.

-----------------------------------------------------------
Web hosting directory

Posted by: admin;   Post:34;   Comments:116;  Date of Join: Nov 05, 2008, 08:04
Post date: Nov 29, 2010, 01:33
ContactReport

Re: modifying auto responder form

i replaced file, and completed the form with all fields complete.


but still no phone number being sent in the email.

Message from: Frank

I.P.: 110.32.133.53

Date: 30.11.2010 12:05

Phone Number:

this is a test pl p
Posted by: fgiurleo;   Post:0;   Comments:4;  Date of Join: Nov 25, 2010, 09:55
Post date: Nov 30, 2010, 04:07
ContactReport

Re: modifying auto responder form

Hello,
In earlier post you submit your index.php file code as:

$subject = $this->strip_slashes(rawurldecode($_POST["subject"]));
if (empty($subject)){ $subject="none";}
$message = $this->strip_slashes(rawurldecode($_POST["message"]));
$message=$this->remove_smarttag($message);
$from = $this->strip_slashes(rawurldecode($_POST["from"]));
$name = $this->strip_slashes(rawurldecode($_POST["name"]));
$phone = rawurldecode($_POST["phone"]);

$msg='Message from: '.$name."\n\n".'I.P.: '.($_SERVER['REMOTE_ADDR'])."\n\n".'Date: '.date('d.m.Y H:i'). "\n\nPhone Number: $Phone\n\n".$message;


Please carefully look the red text; $phone and $Phone are not same. Replace $Phone with $phone.

-----------------------------------------------------------
Web hosting directory

Posted by: admin;   Post:34;   Comments:116;  Date of Join: Nov 05, 2008, 08:04
Post date: Nov 30, 2010, 07:10
ContactReport