Monday, 30 September 2013

where should i paste my html form code in joomla?

where should i paste my html form code in joomla?

I'm working in joomla i have one custom contact form i have created that
in html code and when user click on submit button i should get all textbox
values email to me.
so i write php code for that.
for e.g there are only two fields in html code in php code like below
<?php
if(isset($_POST['email'])) {
$email_to = "test@gmail.com";
$email_subject = "mail";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the
form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// add validation for other fields if needed
if(!isset($_POST['Applicant_name']) ||
!isset($_POST['email']))) {
died('We are sorry, but there appears to be a problem with the
form you submitted.');
}
//all fields with there name to send in email
$name = $_POST['name']; // required
$email= $_POST['email']; // required
$error_message = "";
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
//show all fields in message body
$email_message .= "Applicant_name: ".clean_string($Applicant_name)."\n";
$email_message .= "name: ".clean_string($dob)."\n";
$email_message .= "email: ".clean_string($sex)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>
where and how I need to paste this code in Joomla?

No comments:

Post a Comment