- This topic is empty.
-
AuthorPosts
-
March 26, 2013 at 2:48 pm #43685Historical Forums UserParticipant
Dear Friends,
Please check this link http://test.pak-energy.com/contacts.html this form is not working please help me for my friend.
ThanksMarch 26, 2013 at 2:50 pm #129790Historical Forums UserParticipantsorry the subject is “Contact form Not Working……”
March 26, 2013 at 3:03 pm #129792Historical Forums UserParticipanthe told me there is no any php file on the web server, he asked, how to create a new contact-form.php ??? for this contact form.
March 26, 2013 at 3:12 pm #129793Historical Forums UserParticipant$subject = “Feedback from WEBSITE” ;
$formurl = “URL” ;
$thankyouurl = “URL” ;
$errorurl = “URL” ;$email_is_required = 1;
$name_is_required = 1;
$comments_is_required = 1;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$smtp_server_win = ” ;
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;
$my_recaptcha_private_key = ” ;//
END OF CONFIGURABLE SECTION
define( ‘MAX_LINE_LENGTH’, 998 );
$headersep = $uself ? “n” : “rn” ;
$content_nl = $forcelf ? “n” : (defined(‘PHP_EOL’) ? PHP_EOL : “n”) ;
$content_type = $use_utf8 ? ‘Content-Type: text/plain; charset=”utf-8″‘ : ‘Content-Type: text/plain; charset=”iso-8859-1″‘ ;
if ($use_sendmailfrom) {
ini_set( ‘sendmail_from’, $mailto );
}
if (strlen($smtp_server_win)) {
ini_set( ‘SMTP’, $smtp_server_win );
}
$envsender = “-f$mailto” ;
$fullname = isset($_POST) ? $_POST : $_POST ;
$email = $_POST ;
$comments = $_POST ;
$http_referrer = getenv( “HTTP_REFERER” );if (!isset($_POST)) {
header( “Location: $formurl” );
exit ;
}
if (($email_is_required && (empty($email) || !preg_match(‘/@/’, $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
header( “Location: $errorurl” );
exit ;
}
if ( preg_match( “/[rn]/”, $fullname ) || preg_match( “/[rn]/”, $email ) ) {
header( “Location: $errorurl” );
exit ;
}
if (strlen( $my_recaptcha_private_key )) {
require_once( ‘recaptchalib.php’ );
$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER, $_POST, $_POST );
if (!$resp->is_valid) {
header( “Location: $errorurl” );
exit ;
}
}
if (empty($email)) {
$email = $mailto ;
}
$fromemail = $use_webmaster_email_for_from ? $mailto : $email ;if (function_exists( ‘get_magic_quotes_gpc’ ) && get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}$messageproper =
“This message was sent from:” . $content_nl .
“$http_referrer” . $content_nl .
”
” . $content_nl .
“Name of sender: $fullname” . $content_nl .
“Email of sender: $email” . $content_nl .
”
COMMENTS
” . $content_nl . $content_nl .
wordwrap( $comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl .
”
” . $content_nl ;$headers =
“From: “$fullname” <$fromemail>” . $headersep . “Reply-To: “$fullname” <$email>” . $headersep . “X-Mailer: chfeedback.php 2.16.2” .
$headersep . ‘MIME-Version: 1.0’ . $headersep . $content_type ;if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( “Location: $thankyouurl” );
exit ;?>
March 26, 2013 at 3:13 pm #129794Historical Forums UserParticipantmy friend give me this PHP code
March 26, 2013 at 3:21 pm #129796Historical Forums UserParticipanthere is the code. please check
March 26, 2013 at 6:35 pm #129822JohnMotylJrParticipant@adnan4ali, first off you have two links to jQuery in your head. Second, i would move all scripts to the bottom of your body. Third i would suggest using ajax to process the form. Fourth, incorporate client side validation. Fifth, add ID’s to your form inputs!?
Im not super strong in php but the basics would be to collect the post data, validate it, and mail it.
If it was me?
html
<form id="form">
<fieldset>
<input type="text" name="name" placeholder="Name" id="js-name">
<input type="email" name="email" placeholder="Email" id="js-email">
<input type="number" name="phone" placeholder="Phone" id="js-phone">
<textarea name="message" placeholder="Message" id="js-message"></textarea>
<button type="reset" id="js-reset">Clear</button>
<button type="submit" id="js-submit">Send</button>
</fieldset>
</form>
<script src="js/jquery-1.7.2.min.js"></script>
<script>
</script>javascript
$('#js-submit').on('click', function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'path/to/submit.php',
data: {
name: $.trim($('#description').val()),
email: $.trim($('#resource').val()),
phone: $.trim($('#language').val()),
message: $.trim($('#title').val())
}
}).error(function (jqXHR, textStatus) {
// errors
}).success(function (data) {
// success from the server
}).complete(function (data) {
// completed
});
});php
<?php
$name = $_POST; // Collects post data for name
$email = $_POST; // " email
$phone = $_POST; // " phone
$message = $_POST; // " message
# Do all your validation here as well as client side
# Use the mail( ) function **if your server supports it, which it should**
?>Always make sure you do client side validation as well as server side.
March 28, 2013 at 2:13 am #129997Historical Forums UserParticipantall information is helpful for me and my friend. thanks i am working on it
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.