Page 1 of 1

Re: Need help with my Custom from Please

Posted: Mon Aug 24, 2009 1:53 pm
by manudubey
Hi Guys,

I am new to this forum and don't know where to seek the help. I have been trying  to make this form work in cmsms.

http://www.fixyourofficechairs.com.au/a ... m.php  (Not ins the CMS )

http://www.fixyourofficechairs.com.au/index.php (This one is inside the CMS )

I have uploaded all the javascript and the process.php inside the uploads/rechairs folder in the cms. When you try to submit the form it validates the from fields and then it moves to the gif animation, and then nothing happens. I think at the point where it suppose to execute the process.php it's stop working. Can any one will be able to tell me how to fix this problem. Please

Here is my Code inside the CMSMS
**********
HTAML
**********
Name:        Phone / Mobile:        Email Address:        Required Reparing Description:       


Message Sent


************
Java script
************

$(document).ready(function() {

//if submit button is clicked
$('#submit').click(function () {

//Get the data from all the fields
var name = $('input[name=name]');
var contact = $('input[name=contact]');
var email = $('input[name=email]');
var comment = $('textarea[name=comment]');

//Simple validation to make sure user entered something
//If error found, add hightlight class to the text field
if (name.val()=='') {
name.addClass('hightlight');
return false;
} else name.removeClass('hightlight');

if (contact.val()=='') {
contact.addClass('hightlight');
return false;
} else contact.removeClass('hightlight');

if (email.val()=='') {
email.addClass('hightlight');
return false;
} else email.removeClass('hightlight');

if (comment.val()=='') {
comment.addClass('hightlight');
return false;
} else comment.removeClass('hightlight');

//organize the data properly
var data = 'name=' + name.val() + '&email=' + email.val() + '&contact=' +
contact.val() + '&comment='  + encodeURIComponent(comment.val());

//disabled all the text fields
$('.text').attr('disabled','true');

//show the loading sign
$('.loading').show();

//start the ajax
$.ajax({
//this is the php file that processes the data and send mail
url: "uploads/prechair/process.php",

//GET method is used
type: "GET",

//pass the data
data: data,

//Do not cache the page
cache: false,

//success
success: function (html) {
//if process.php returned 1/true (send mail success)
if (html==1) {
//hide the form
$('.loading').fadeOut('slow');

//show the success message
$('.done').fadeIn(2000).fadeOut(5000);

//if process.php returned 0/false (send mail failed)
} else alert('Sorry, unexpected error. Please try again later.');
}
});

//cancel the submit button default behaviours
return false;
});
});


*********
PHP
*********

';
//sender
$from = $name . ' ';

//subject and the html message
$subject = 'Quick Online Enquiry ' . $name;
$message = '





Name' . $name . '
Phone / Mobile:' . $contact . '
Email Address:' . $email . '
Required Reparing Description:' . nl2br($comment) . '


';

//send the mail
$result = sendmail($to, $subject, $message, $from);

//if POST was used, display the message straight away
if ($_POST) {
if ($result) echo 'Thank you! We have received your message.';
else echo 'Sorry, unexpected error. Please try again later';

//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
echo $result;
}

//if the errors array has values
} else {
//display the errors message
for ($i=0; $i';
echo 'Back';
exit;
}


//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";

$result = mail($to,$subject,$message,$headers);

if ($result) return 1;
else return 0;
}

?>

Re: Need help with my Custom from Please

Posted: Sun Aug 30, 2009 7:41 pm
by Dr.CSS
I tried both of them and don't see anything that couldn't be done using form builder module, other wise you may not get much help, unless you want to move this to the Pay for Help board...