Problem setting up quickcontact.php

4 replies · opened Aug 17, 2016

Ssicnarf033Aug 17, 2016

Hello,

Before I get into my main question, I was wondering if there is any possibility of integrating the contact form with Eloqua and having server side validation? Is this possible?

Main problem: I am building a company website that requires a contact form. I followed the instructions in the documentation but it's not working so I don't know how to set it up correctly. I added more fields (changed name to first name, added last name, company, title, phone).

Here is the website (in QA): corp.nimblefish.com/newsite

HTML:


				
				
					
						
							
								Send Us An Email
							
							

								

									

								  

					        
					          First name *
					          
					        

					        
					          Last name *
					          
					        

									

					        
					          Company *
					          
					        

									

					        
					          Title *
					          
					        

									

					        
					          Email *
					          
					        

									

					        
					          Phone *
					        	
					        

									

					        
					          Please briefly describe your marketing goals for Nimblefish products:
										
					        

					        
					          
					        

									
										[Close](#)
										Send Message
					        

				      
						
					
				

PHP:

 'francis.ngo@rrd.com', // Your Email Address
				'name' => 'Francis' // Your Name
			);

// $toemails[] = array(
// 				'email' => 'username@website.com', // Your Email Address
// 				'name' => 'Your Name' // Your Name
// 			);
//
// $toemails[] = array(
// 				'email' => 'username@website.com', // Your Email Address
// 				'name' => 'Your Name' // Your Name
// 			);

// Form Processing Messages
$message_success = 'We have **successfully** received your Message and will get Back to you as soon as possible.';

// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = ''; // Your reCaptcha Secret

$mail = new PHPMailer();

// If you intend you use SMTP, add your SMTP Code after this Line

if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
	if( $_POST['emailAddress'] != '' ) {

		$fname = $_POST['firstName'];
		$lname = $_POST['lastName'];
		$company = $_POST['company'];
		$title = $_POST['title'];
		$email = $_POST['emailAddress'];
		$phone = $_POST['busPhone'];
		$message = $_POST['comments1'];

		$subject = 'New Message From Nimblefish Contact Form';

		$botcheck = $_POST['quick-contact-form-botcheck'];

		if( $botcheck == '' ) {

			$mail->SetFrom( $email , $name );
			$mail->AddReplyTo( $email , $name );
			foreach( $toemails as $toemail ) {
				$mail->AddAddress( $toemail['email'] , $toemail['name'] );
			}
			$mail->Subject = $subject;

			$fname = isset($fname) ? "First Name: $fname

" : '';
			$lname = isset($lname) ? "Last Name: $lname

" : '';
			$company = isset($company) ? "Company: $company

" : '';
			$title = isset($title) ? "Title: $title

" : '';
			$email = isset($email) ? "Email: $email

" : '';
			$phone = isset($phone) ? "Phone: $phone

" : '';
			$message = isset($message) ? "Comments: $message

" : '';

			$referrer = $_SERVER['HTTP_REFERER'] ? '

This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';

			$body = "$fname $lname $compnay $title $email $phone $message $referrer";

			// Runs only when reCaptcha is present in the Contact Form
			if( isset( $_POST['g-recaptcha-response'] ) ) {
				$recaptcha_response = $_POST['g-recaptcha-response'];
				$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response );

				$g_response = json_decode( $response );

				if ( $g_response->success !== true ) {
					echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
					die;
				}
			}

			$mail->MsgHTML( $body );
			$sendEmail = $mail->Send();

			if( $sendEmail == true ):
				echo '{ "alert": "success", "message": "' . $message_success . '" }';
			else:
				echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.

**Reason:**
' . $mail->ErrorInfo . '" }';
			endif;
		} else {
			echo '{ "alert": "error", "message": "Bot **Detected**.! Clean yourself Botster.!" }';
		}
	} else {
		echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
	}
} else {
	echo '{ "alert": "error", "message": "An **unexpected error** occured. Please Try Again later." }';
}

?>
Ssicnarf033Aug 17, 2016

I don't have much experience with PHP and using it for back end validation, please help. Thanks.

Ssicnarf033Aug 17, 2016

The problem is when I submit the form, form is processing (with loader) and then I get 500 internal error on quickcontact.php in devtool.

Ssicnarf033Aug 18, 2016

Is anyone available to help? Thanks.

SSemicolon WebSTAFFSep 2, 2016

Hello,

[sb_private_reply]We Really Apologize about the Delays in replying to your Support Query and Really Really Appreciate your Patience with us![/sb_private_reply]

We have just checked out your Website and the issue is that the http://corp.nimblefish.com/newsite/include/quickcontact.php File which processes the Quick Contact Form does not seem to be executable and on this basis we assume that PHP is not installed on your Web Server which is why your Contact Forms are not working. Please consider contacting your Web Hosting Provider and ask them to install the PHP for you. This will definitely fix your issue.

Thanks for your Patience. Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

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