Form not working

8 replies · opened May 15, 2017

Sswebe3qnMay 15, 2017

Hi,

for some reason the contact form on my page http://webersdesign.com/forexfix/kontakt.html is not working. I've tried different things but I do not receive any emails. Do you know why?

Thanks in advance,
Stefan

Sswebe3qnMay 15, 2017

And how can I add custom fields, like 'company', so that it works?

SSemicolon WebSTAFFMay 15, 2017

Hello,

  1. The Contact Form on your Page is not working because of some jQuery Issue in your Custom js/scripts.js File with the niceSelect Plugin. It also appears that the PHPMailer Files have not been uploaded to your Servers: http://webersdesign.com/forexfix/include/sendemail.php . Please fix these errors and your issue with the Contact Form will be automatically resolved.

  2. This is Definitely Possible but you will need to Edit the include/sendemail.php File to Add the Custom Fields. There are 3 Steps to configure this in the include/sendemail.php File:

a. Find the following code and duplicate it to add the New Field:

$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';

Example:

$newfield = isset( $_POST['template-contactform-newfield'] ) ? $_POST['template-contactform-newfield'] : '';

Make sure that the template-contactform-newfield is same as the Form Input’s name attribute in the HTML.

b. Now, find the following code just a few lines below and duplicate it to add the New Field:

$name = isset($name) ? "Name: $name

" : '';

Example:

$newfield = isset($newfield) ? "New Field: $newfield

" : '';

c. You now simply need to Add the New Field to the following code:

$body = "$name $email $phone $service $message $referrer";

Example:

$body = "$name $email $phone $newfield $service $message $referrer";

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Sswebe3qnMay 16, 2017

Hi,

Thanks for your fast reply!

Can you check it again, please? I removed the niceSelect Plugin on the contact form, the 'subject' field and added a custom field 'company'(Firma) but it seems that there is still an issue. Error: 'Could not instantiate mail function'. Please check the sendemail.php file I attached.

Thank you for your help!

Sswebe3qnMay 16, 2017

OK, there has been an upload error. Here is the snippet of my sendemail.php:

$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
$email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
$service = isset( $_POST['template-contactform-service'] ) ? $_POST['template-contactform-service'] : '';
$company = isset( $_POST['template-contactform-company'] ) ? $_POST['template-contactform-company'] : '';
$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';

	$botcheck = $_POST['template-contactform-botcheck'];

	if( $botcheck == '' ) {

		$mail->SetFrom( $email , $name );
		$mail->AddReplyTo( $email , $name );
		foreach( $toemails as $toemail ) {
			$mail->AddAddress( $toemail['email'] , $toemail['name'] );
		}
		$mail->Subject = 'Eine neue Nachricht von Forexfix.de';

		$name = isset($name) ? "Name: $name<br><br>" : '';
		$email = isset($email) ? "Email: $email<br><br>" : '';
		$phone = isset($phone) ? "Telefon: $phone<br><br>" : '';
		$company = isset($company) ? "Firma: $company<br><br>" : '';
		$service = isset($service) ? "Branche: $service<br><br>" : '';
		$message = isset($message) ? "Nachricht: $message<br><br>" : '';

		$referrer = $_SERVER['HTTP_REFERER'] ? '<br><br><br>This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';

		$body = "$name $email $phone $company $service $message $referrer";
SSemicolon WebSTAFFMay 16, 2017

Hello,

  1. The niceSelect JS Function still appears to be there in the js/scripts.js File. Please check using your Inspect Element Feature.

  2. Regarding your Issue with the Contact Form PHP File, the codes appear to be fine but it appears that the PHP mail() Function does not work on your Servers or blocked by your Web Hosting Provider. You can contact your Web Hosting Provider for this and they can fix this for you or you will need to use the SMTP Configuration for this. Please check out the Documentation > Widgets > Contact Forms Section for the SMTP Setup Instructions.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Sswebe3qnMay 16, 2017

Sorry, I forgot to delete the line where I called the scripts.js. It seems that it still does not work, even without the niceSelect function.
I included the SMTP mail settings in the sendemail.php now but there is still an error. Please check: http://webersdesign.com/forexfix/kontakt.html

Thank you very much for taking the time to help me! I really appreciate your patience.

Sswebe3qnMay 17, 2017

OK, so I finally figured out why it didn't work:

If you enter an email like 'email@domain' (without '.com') it passes the email validation (so no red border; like everything is fine) but then the error occurs.
If you enter a correct email like 'email@domain.com' the form can be sent.
Is there a way to change the email validation so that it checks for the '.com', '.de', '.net' and so on?

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard