[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Thickbox issue using PHP Form

Asked by rurth24 in PHP Scripting Language

Tags: PHP, FF, IE, http://niceinstrumentation.com/contact-us.php

Hey all,

I'm  having a weird thickbox issue. I'm loading a simple PHP Mail Form into a thickbox window (which works fine) but, the form doesn't work on the initial load. To get it to work you need to hit the submit button. Once you hit the submit button it reloads and works fine. It's def not the form because if I go straight to the same form without the thickbox it works fine on the first try.

See it in action:
http://niceinstrumentation.com/contact-us.php
NORTH AMERICA uses thickbox, the other don't.

I didn't write the php code.

Below is the thickbox call
<a href="/mail/contact-mod-us.php?KeepThis=true&TB_iframe=true&width=450&height=260" class="thickbox">
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
<?
########################################################
# PHP Mail Function with Validation for email and phone#
########################################################
 
############ READ THIS FIRST ##############################
 
/*
   In order to get this form integrated and working you'll need to insert
   the right information in the right place. Wherever you see a # INSERT HERE #
   is where you'll make changes in order to customize the form for your client.
   
   It's easy, just look throught the code for: # INSERT HERE # and everything
   should work nicely.
 
   You don't have to worry about creating variables as this form loops through
   all controls you add to the page and adds their key and value pairs to the 
   generated email. YES! It's that simple.
 
   If you need more validation options ask for help or use dreamweaver behaviors.
*/
 
###########################################################
 
 
if ($_REQUEST['posted'] && isReferrerMatch()) {
	
 
	# validate correct email address
	if (!preg_match('/[a-z0-9\.\_\-]+\@[a-z0-9\_\-]+(.[a-z0-9\.\_\-]+)+/', $_POST['email'])) {
		$msg .= "<strong>EMAIL</strong> must be a valid email address.<br>";
	}
 
	if ($msg=='') {
	
		$DontSendKeys = array('posted','Submit','x','y');
		
		foreach ($_POST as $key=>$value) {
			if (!in_array($key,$DontSendKeys)) {
				$message .= strtoupper(str_replace('_',' ',$key)).": $value<br>";
			}
		}
		
		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
		$headers .= 'From: sales@niceinstrumentation.com' . "\r\n";
		
		# INSERT HERE OPTIONAL #########################
		
		// if you want a bbc send to your email address for testing, uncomment 
		// the next line by deleting the "//" and put in your email address.		 
		
		$headers .= 'Bcc: rurth24@yahoo.com' ."\r\n"; 
		
		################################################
		
		
		# INSERT HERE ##################################
		
		/* 
		   you must uncomment the following two lines and change the value in
		   the $to and $subject variables in order for the form to work
		*/  
		 $subject = "Nice Instrumentation US Contact Form";
		 $to = "sales@niceinstrumentation.com";
 
		################################################
		
		send_mail($to,$subject,$message,$headers);
		$msg = "Your contact information has been sent.  Please allow 24-48 hours for a response.";
		
		# INSERT HERE ##################################
		
		/* 
		   you must uncomment the following lines and change the location
		   of where you would like the page to redirect after successful 
		   form submission.
		*/  
 
		 header("Location: thank-you.php");
		exit;
		################################################
		
	}
}
 
# send mail function
function send_mail($to,$subject,$message,$headers)
{
 
	mail($to,$subject,$message,$headers);
}
 
# check if form is posting to itself
function isReferrerMatch()
{
 
	if ($_SERVER['SERVER_PORT'] == 443) 
	{
		$http_protocol='https';
	} else {
		$http_protocol='http';
	}
	
	if ($_SERVER['HTTP_REFERER'] == $http_protocol.'://'.$_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'])
	{
		return true;
	} else {
		return false;
	}
	
}
?>
[+][-]10/10/08 01:55 PM, ID: 22690723Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Sign Up Now!
Solution Provided By: khaledf
Participating Experts: 1
Solution Grade: A
 
[+][-]10/10/08 01:43 PM, ID: 22690624Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/10/08 01:51 PM, ID: 22690691Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/10/08 06:47 PM, ID: 22692112Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_2_20070628