Home › Forums › All Other Themes › Required fields in contact form
- This topic has 10 replies, 2 voices, and was last updated 7 years, 3 months ago by Sonnal S Sinha.
-
AuthorPosts
-
January 10, 2017 at 8:27 am #58040
I changed the translation in the custom-functions.php. Now all my required fields are gone and the email isn`t sent 🙁 Nothing happens 🙁
Can somebody help?
This is the Website: http://www.friseurjulia.de/kontakt/
Here is the code I changed:
function contactform_func( $atts ) {
$atts = shortcode_atts( array(
‘to_email’ => get_bloginfo(‘admin_email’),
‘title’ => ‘Contact enquiry – ‘.home_url( ‘/’ ),
), $atts );$cform = “<div class=\”main-form-area\” id=\”contactform_main\”>”;
$cerr = array();
if( isset($_POST[‘c_submit’]) && $_POST[‘c_submit’]==’Submit’ ){
$name = trim( $_POST[‘c_name’] );
$email = trim( $_POST[‘c_email’] );
$phone = trim( $_POST[‘c_phone’] );
$website = trim( $_POST[‘c_website’] );
$comments = trim( $_POST[‘c_comments’] );
$captcha = trim( $_POST[‘c_captcha’] );
$captcha_cnf = trim( $_POST[‘c_captcha_confirm’] );if( !$name )
$cerr[‘name’] = ‘Bitte tragen Sie Ihren Namen ein.’;
if( ! filter_var($email, FILTER_VALIDATE_EMAIL) )
$cerr[’email’] = ‘Bitte geben Sie eine gültige Emailadresse an.’;
if( !$phone )
$cerr[‘phone’] = ‘Bitte geben Sie Ihre Telefonnummer an, damit wir bei Rückfragen erreichen können.’;
if( !$comments )
$cerr[‘comments’] = ‘Bitte schreiben Sie uns eine Nachricht.’;
if( !$captcha || (md5($captcha) != $captcha_cnf) )
$cerr[‘captcha’] = ‘Bitte tragen Sie das korrekte Ergebnis ein.’;if( count($cerr) == 0 ){
$subject = $atts[‘title’];
$headers = “From: “.$name.” <” . strip_tags($email) . “>\r\n”;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-type: text/html; charset=iso-8859-1\r\n”;$message = ‘<html><body>
<table>
<tr><td>Name: </td><td>’.$name.'</td></tr>
<tr><td>Email: </td><td>’.$email.'</td></tr>
<tr><td>Telefon: </td><td>’.$phone.'</td></tr>
<tr><td>Website: </td><td>’.$website.'</td></tr>
<tr><td>Nachricht: </td><td>’.$comments.'</td></tr>
</table>
</body>
</html>’;
mail( $atts[‘to_email’], $subject, $message, $headers);
$cform .= ‘<div class=”success_msg”>Vielen Dank für Ihre Anfrage! Wir werden uns so schnell wie möglich bei Ihnen melden.</div>’;
unset( $name, $email, $phone, $website, $comments, $captcha );
}else{
$cform .= ‘<div class=”error_msg”>’;
$cform .= implode(‘<br />’,$cerr);
$cform .= ‘</div>’;
}
}$capNum1 = rand(1,4);
$capNum2 = rand(1,5);
$capSum = $capNum1 + $capNum2;
$sumStr = $capNum1.” + “.$capNum2 .” = “;$cform .= “<form name=\”contactform\” action=\”#contactform_main\” method=\”post\”>
<p><input type=\”text\” name=\”c_name\” value=\””. ( ( empty($name) == false ) ? $name : “” ) .”\” placeholder=\”Name\” /></p>
<p><input type=\”email\” name=\”c_email\” value=\””. ( ( empty($email) == false ) ? $email : “” ) .”\” placeholder=\”Email\” /></p><div class=\”clear\”></div>
<p><input type=\”tel\” name=\”c_phone\” value=\””. ( ( empty($phone) == false ) ? $phone : “” ) .”\” placeholder=\”Telefon\” /></p>
<p><input type=\”url\” name=\”c_website\” value=\””. ( ( empty($website) == false ) ? $website : “” ) .”\” placeholder=\”Website\” /></p><div class=\”clear\”></div>
<p><textarea name=\”c_comments\” placeholder=\”Nachricht\”>”. ( ( empty($comments) == false ) ? $comments : “” ) .”</textarea></p><div class=\”clear\”></div>”;
$cform .= “<p><span class=\”capcode\”>$sumStr</span><input style=\”width:200px;\” type=\”text\” placeholder=\”Ergebnis\” value=\””. ( ( empty($captcha) == false ) ? $captcha : “” ) .”\” name=\”c_captcha\” /><input type=\”hidden\” name=\”c_captcha_confirm\” value=\””. md5($capSum).”\”></p><div class=\”clear\”></div>”;
$cform .= “<p class=\”sub\”><input type=\”submit\” name=\”c_submit\” value=\”Abschicken\” class=\”search-submit\” /></p>
</form>
</div>”;return $cform;
}
add_shortcode( ‘contactform’, ‘contactform_func’ );January 10, 2017 at 11:54 am #58090Hi Eva,
Kindly send us your URL of the site and WordPress admin details via sktthemes.net/contact
Please mention this forum URL while replying so that we understand what needs to be done.
Regards,
BradJanuary 16, 2017 at 1:32 pm #58871Did you receive my Email?
January 16, 2017 at 1:35 pm #58876Hi,
We didn’t receive any email from you. Kindly send us via sktthemes.net/contact
Regards,
BradJanuary 16, 2017 at 1:40 pm #58878I did send it again….hope you received it now 😉
January 16, 2017 at 1:46 pm #58881Recieved
January 17, 2017 at 5:37 am #58934Hi,
This issue was resolved from our end. Kindly check and confirm.
Regards,
BradJanuary 17, 2017 at 7:34 am #58961It is working so far 🙂 Now the only Problem is, that the emails aren’t sent 🙁 Where are they now?
January 17, 2017 at 12:35 pm #59021Hi,
Emails sent on [email protected]
You can change the email address from sidebar.php
Regards,
BradJanuary 17, 2017 at 12:39 pm #59023Ah…OK….that i didn’t know…
Thanks for your help 🙂January 17, 2017 at 12:44 pm #59026🙂
-
AuthorPosts
- The topic ‘Required fields in contact form’ is closed to new replies.