Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- if(isset($_POST['email'])) {
- function died($error) {
- 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();
- }
- if(!isset($_POST['name']) ||
- !isset($_POST['company']) ||
- !isset($_POST['email']) ||
- !isset($_POST['telephone']) ||
- !isset($_POST['comments'])) {
- died('We are sorry, but there appears to be a problem with the form you submitted.');
- }
- $name = $_POST['name'];
- $company = $_POST['company'];
- $email_from = $_POST['email'];
- $telephone = $_POST['telephone'];
- $comments = $_POST['comments'];
- $error_message = "";
- $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
- if(!preg_match($email_exp,$email_from)) {
- $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
- }
- $string_exp = "/^[A-Za-z .'-]+$/";
- if(!preg_match($string_exp,$name)) {
- $error_message .= 'The name you entered does not appear to be valid.<br />';
- }
- if(!preg_match($string_exp,$company)) {
- $error_message .= 'The company you entered does not appear to be valid.<br />';
- }
- if(strlen($comments) < 2) {
- $error_message .= 'The Comments you entered do not appear to be valid.<br />';
- }
- if(strlen($error_message) > 0) {
- died($error_message);
- }
- function clean_string($string) {
- $bad = array("content-type","bcc:","to:","cc:","href");
- return str_replace($bad,"",$string);
- }
- $service_url = 'https://COMPANY_NAME.quickbase.com/db/TABLE_ID?a=API_AddRecord&_fid_6=' . $name . '&ticket=' . $xml->ticket . '&apptoken=APPTOKEN' . '&_fid_7=' . $company . '&_fid_8=' . $email_from . '&_fid_9=' . $telephone . '&_fid_10=' . $comments . '';
- $curl3 = curl_init($service_url);
- curl_setopt($curl3, CURLOPT_RETURNTRANSFER, true);
- echo '<iframe id="test" style="display:none;" width=0 height=0 src="'.$service_url.'" visible=false></iframe>';
- ?>
- <!-- include your own success html here -->
- Thank you for contacting us. We will be in touch with you very soon.
- <?php
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement