Page 1 of 1

email.php code is broken and need help

Posted: Sat Apr 29, 2006 12:04 pm
by MandrivaUser
hawleyjr | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I really need your help. We are losing customers.  Below is the error message our clients are getting when they fill out completly our forms:

 Your request could not be processed.
Please enter a name.
Please enter a phone.
Please enter a company name.
Please enter an email address.
Please enter an address.
Please enter a city.
Please enter a postal code.
Please enter a country name.


All required fields (marked with '*') must be entered for the form to be processed.

RETURN TO THE FORM



I can't figure out what is wrong with my email.php script and here is the code below:

Code: Select all

<?php 
		
		/***************ADMINISTRATION************/
		
		$to = "sales@endovia.com";
		$subject = "Request for Quotation"; 
		
		/*****************************************/
		
		
		
		$error = null;
		$report = "               Request for Quotation\n\n";
		
		$report .= "_______________CONTACT INFORMATION_______________\n\n";
		
		if($name != null) {
			$report .= "Name: $name\n";
		}
		else {
			$error .= "Please enter a name.<br>";
		}
		
		if($phone != null) {
			$report .= "Phone: $phone\n";
		}
		else {
			$error .= "Please enter a phone.<br>";
		}
		
		if($company != null) {
			$report .= "Company: $company\n";
		}
		else {
			$error .= "Please enter a company name.<br>";
		}
				
		if($email != null) {
			$report .= "Email: $email\n";
		}
		else {
			$error .= "Please enter an email address.<br>";
		}
		
		if($address1 != null) {
			$report .= "Address: $address1\n";
			if($address2 != null) {
				$report .= "         $address2\n";
				//if($address3 != null) {
					//$report .= "         $address3\n";
				//}
			}
		}
		else {
			$error .= "Please enter an address.<br>";
		}
		
		if($city != null) {
			$report .= "City: $city\n";
		}
		else {
			$error .= "Please enter a city.<br>";
		}
		
		if($state != "none") {
			$report .= "State: $state\n";
		}
		else {
			$error .= "Please enter a state.<br>";
		}
		
		if($postalcode != null) {
			$report .= "Postalcode: $postalcode\n";
		}
		else {
			$error .= "Please enter a postal code.<br>";
		}

		if($country != null) {
			$report .= "Country: $country\n";
		}
		else {
			$error .= "Please enter a country name.<br>";
		}
		
		
		$report .= "\n_________________MODULATOR SPECIFICATIONS________________\n\n";

		
		if($Mod_Peak_kV != null) {
			$report .= "Mod_Peak_kV: $Mod_Peak_kV\n";
		}

		if($Mod_Peak_A != null) {
			$report .= "Mod_Peak_A: $Mod_Peak_A\n";
		}

		if($Mod_Avg_A != null) {
			$report .= "Mod_Avg_A: $Mod_Avg_A\n";
		}

		if($Mod_Avg_Pwr_kW!= null) {
			$report .= "Mod_Avg_Pwr_kW: $Mod_Avg_Pwr_kW\n";
		}

		
		if($Mod_Input_Pwr != null) {
			$report .= "Mod_Input_Pwr: $Mod_Input_Pwr\n";
		}

		if($Mod_Duty_Percent != null) {
			$report .= "Mod_Duty_Percent: $Mod_Duty_Percent\n";
		}
		if($Mod_Load_Cap_microF != null) {
			$report .= "Mod_Load_Cap_microF: $Mod_Load_Cap_microF\n";
		}
		
		if($Mod_Load_Ind_milliH != null) {
			$report .= "Mod_Load_Ind_milliH: $Mod_Load_Imp_milliH\n";
		}
		if($Mod_Pulse_wid_microsec != null) {
			$report .= "Mod_Pulse_wid_microsec: $Mod_Pulse_wid_microsec\n";
		}
		
		if($Mod_Rep_rate_Hz!= null) {
			$report .= "Mod_Rep_rate_Hz: $Mod_Rep_rate_Hz\n";
		}
		
		if($Mod_RiseFall_microsec!= null) {
			$report .= "Mod_RiseFall_microsec: $Mod_RiseFall_microsec\n";
		}
		
		if($Mod_Droop_Percent!= null) {
			$report .= "Mod_Droop_Percent: $Mod_Droop_Percent\n";
		}
		
		if($Mod_Use != null) {
			$report .= "Mod_Use: $Mod_Use\n";
		}
		
		if($Mod_special!= null) {
			$report .= "Mod_special: $Mod_special\n";
		}
		
		if($Mod_Qty!= null) {
			$report .= "Mod_Qty: $Mod_Qty\n";
		}

		if($Mod_Del_Date!= null) {
			$report .= "Mod_Del_Date: $Mod_Del_Date\n";
		}

		$report .= "\n_________________POWER SUPPLY SPECIFICATIONS________________\n\n";

		if($PS_kV!= null) {
			$report .= "PS_kV: $PS_kV\n";
		}

		if($PS_Peak_A!= null) {
			$report .= "PS_Peak_A: $PS_Peak_A\n";
		}

		if($PS_Avg_A!= null) {
			$report .= "PS_Avg_A: $PS_Avg_A\n";
		}

		if($PS_Input_Pwr!= null) {
			$report .= "PS_Input_Pwr: $PS_Input_Pwr\n";
		}

		
		if($PS_Ripple_Percent!= null) {
			$report .= "PS_Ripple_Percent: $PS_Ripple_Percent\n";
		}

		if($PS_VR_Percent!= null) {
			$report .= "PS_VR_Percent: $PS_VR_Percent\n";
		}

		if($Remote!= null) {
			$report .= "Remote: $Remote\n";
		}
		
		if($PS_use!= null) {
			$report .= "PS_use: $PS_use\n";
		}
		
		if($PS_Qty!= null) {
			$report .= "PS_Qty: $PS_Qty\n";
		}

		if($PS_Del_Date!= null) {
			$report .= "PS_Del_Date: $PS_Del_Date\n";
		}


				
		if($error == null) {
			if (mail($to, $subject, $report, "From: $email\nX-Mailer: AZONPROMOTIONS\n"))
			{
			   	//getURL("thankyou_03.htm");
				header("Location: thankyou_03.htm");
				//Header ("Location: http://endovia.vh.primushost.com/test/thankyou_03.htm"); 
				
				

			}			
			else
			{ 
				?>
				<html>
				<head>
				<title>QUOTATION FORM </title>
				<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
				</head>

				<body background="">
				<center>
   				<p><i><strong>Message delivery failed...</strong></i></p>
				<a href=javascript:history.back()> RETURN TO THE FORM </a>
				</center>
				<?php
			}	
	}
	else {  
		?>
		<center>
		<font color=#FF0000>
		<font size=5><strong>Your request could not be processed. </strong></font><br>
		<?php echo("$error"); ?>
		<br><br>
		<strong>All required fields (marked with '*') must be entered for the form to be processed.</strong></font><br><br>
		<a href=javascript:history.back()> RETURN TO THE FORM </a>
		</center>
		<?php
	}
	?>
</body>
</html>



Please I need help with this:

MandrivaUser


hawleyjr | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]

Posted: Sat Apr 29, 2006 7:47 pm
by Jade
Hey there,

I've noticed that some servers have problems retrieving posted data without implicitly asking it to retrieve the data. Try doing something like this:

Code: Select all

<?php 

$name = $_POST['name'];
$phone = $_POST['phone'];
$company = $_POST['company'];
$email = $_POST['email'];
// and contine adding all the variables here that you are trying to get to
                
                /***************ADMINISTRATION************/ 
                
                $to = "sales@endovia.com"; 
                $subject = "Request for Quotation"; 
                
                /*****************************************/ 
                
                
                
                $error = null; 
                $report = "               Request for Quotation\n\n"; 
                
                $report .= "_______________CONTACT INFORMATION_______________\n\n"; 
                
                if($name != null) { 
                        $report .= "Name: $name\n"; 
                } 
                else { 
                        $error .= "Please enter a name.<br>"; 
                } 
                
                if($phone != null) { 
                        $report .= "Phone: $phone\n"; 
                } 
                else { 
                        $error .= "Please enter a phone.<br>"; 
                } 
                
                if($company != null) { 
                        $report .= "Company: $company\n"; 
                } 
                else { 
                        $error .= "Please enter a company name.<br>"; 
                } 
                                
                if($email != null) { 
                        $report .= "Email: $email\n"; 
                } 
                else { 
                        $error .= "Please enter an email address.<br>"; 
                } 
                
                if($address1 != null) { 
                        $report .= "Address: $address1\n"; 
                        if($address2 != null) { 
                                $report .= "         $address2\n"; 
                                //if($address3 != null) { 
                                        //$report .= "         $address3\n"; 
                                //} 
                        } 
                } 
                else { 
                        $error .= "Please enter an address.<br>"; 
                } 
                
                if($city != null) { 
                        $report .= "City: $city\n"; 
                } 
                else { 
                        $error .= "Please enter a city.<br>"; 
                } 
                
                if($state != "none") { 
                        $report .= "State: $state\n"; 
                } 
                else { 
                        $error .= "Please enter a state.<br>"; 
                } 
                
                if($postalcode != null) { 
                        $report .= "Postalcode: $postalcode\n"; 
                } 
                else { 
                        $error .= "Please enter a postal code.<br>"; 
                } 

                if($country != null) { 
                        $report .= "Country: $country\n"; 
                } 
                else { 
                        $error .= "Please enter a country name.<br>"; 
                } 
                
                
                $report .= "\n_________________MODULATOR SPECIFICATIONS________________\n\n"; 

                
                if($Mod_Peak_kV != null) { 
                        $report .= "Mod_Peak_kV: $Mod_Peak_kV\n"; 
                } 

                if($Mod_Peak_A != null) { 
                        $report .= "Mod_Peak_A: $Mod_Peak_A\n"; 
                } 

                if($Mod_Avg_A != null) { 
                        $report .= "Mod_Avg_A: $Mod_Avg_A\n"; 
                } 

                if($Mod_Avg_Pwr_kW!= null) { 
                        $report .= "Mod_Avg_Pwr_kW: $Mod_Avg_Pwr_kW\n"; 
                } 

                
                if($Mod_Input_Pwr != null) { 
                        $report .= "Mod_Input_Pwr: $Mod_Input_Pwr\n"; 
                } 

                if($Mod_Duty_Percent != null) { 
                        $report .= "Mod_Duty_Percent: $Mod_Duty_Percent\n"; 
                } 
                if($Mod_Load_Cap_microF != null) { 
                        $report .= "Mod_Load_Cap_microF: $Mod_Load_Cap_microF\n"; 
                } 
                
                if($Mod_Load_Ind_milliH != null) { 
                        $report .= "Mod_Load_Ind_milliH: $Mod_Load_Imp_milliH\n"; 
                } 
                if($Mod_Pulse_wid_microsec != null) { 
                        $report .= "Mod_Pulse_wid_microsec: $Mod_Pulse_wid_microsec\n"; 
                } 
                
                if($Mod_Rep_rate_Hz!= null) { 
                        $report .= "Mod_Rep_rate_Hz: $Mod_Rep_rate_Hz\n"; 
                } 
                
                if($Mod_RiseFall_microsec!= null) { 
                        $report .= "Mod_RiseFall_microsec: $Mod_RiseFall_microsec\n"; 
                } 
                
                if($Mod_Droop_Percent!= null) { 
                        $report .= "Mod_Droop_Percent: $Mod_Droop_Percent\n"; 
                } 
                
                if($Mod_Use != null) { 
                        $report .= "Mod_Use: $Mod_Use\n"; 
                } 
                
                if($Mod_special!= null) { 
                        $report .= "Mod_special: $Mod_special\n"; 
                } 
                
                if($Mod_Qty!= null) { 
                        $report .= "Mod_Qty: $Mod_Qty\n"; 
                } 

                if($Mod_Del_Date!= null) { 
                        $report .= "Mod_Del_Date: $Mod_Del_Date\n"; 
                } 

                $report .= "\n_________________POWER SUPPLY SPECIFICATIONS________________\n\n"; 

                if($PS_kV!= null) { 
                        $report .= "PS_kV: $PS_kV\n"; 
                } 

                if($PS_Peak_A!= null) { 
                        $report .= "PS_Peak_A: $PS_Peak_A\n"; 
                } 

                if($PS_Avg_A!= null) { 
                        $report .= "PS_Avg_A: $PS_Avg_A\n"; 
                } 

                if($PS_Input_Pwr!= null) { 
                        $report .= "PS_Input_Pwr: $PS_Input_Pwr\n"; 
                } 

                
                if($PS_Ripple_Percent!= null) { 
                        $report .= "PS_Ripple_Percent: $PS_Ripple_Percent\n"; 
                } 

                if($PS_VR_Percent!= null) { 
                        $report .= "PS_VR_Percent: $PS_VR_Percent\n"; 
                } 

                if($Remote!= null) { 
                        $report .= "Remote: $Remote\n"; 
                } 
                
                if($PS_use!= null) { 
                        $report .= "PS_use: $PS_use\n"; 
                } 
                
                if($PS_Qty!= null) { 
                        $report .= "PS_Qty: $PS_Qty\n"; 
                } 

                if($PS_Del_Date!= null) { 
                        $report .= "PS_Del_Date: $PS_Del_Date\n"; 
                } 


                                
                if($error == null) { 
                        if (mail($to, $subject, $report, "From: $email\nX-Mailer: AZONPROMOTIONS\n")) 
                        { 
                                //getURL("thankyou_03.htm"); 
                                header("Location: thankyou_03.htm"); 
                                //Header ("Location: http://endovia.vh.primushost.com/test/thankyou_03.htm"); 
                                
                                

                        }                      
                        else 
                        { 
                                ?> 
                                <html> 
                                <head> 
                                <title>QUOTATION FORM </title> 
                                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
                                </head> 

                                <body background=""> 
                                <center> 
                       <p><i><strong>Message delivery failed...</strong></i></p> 
                                <a href=javascript:history.back()> RETURN TO THE FORM </a> 
                                </center> 
                                <?php 
                        }        
        } 
        else {  
                ?> 
                <center> 
                <font color=#FF0000> 
                <font size=5><strong>Your request could not be processed. </strong></font><br> 
                <?php echo("$error"); ?> 
                <br><br> 
                <strong>All required fields (marked with '*') must be entered for the form to be processed.</strong></font><br><br> 
                <a href=javascript:history.back()> RETURN TO THE FORM </a> 
                </center> 
                <?php 
        } 
        ?>

Posted: Sat Apr 29, 2006 8:00 pm
by Charles256
erm..that's not a problwem..that's a security feature. :-D

Posted: Sat Apr 29, 2006 8:08 pm
by n00b Saibot
Charles256 wrote:problwem
ooo that looks serious...

Posted: Sat Apr 29, 2006 8:10 pm
by Charles256
smart ass ;) stay on topic before I go lock this thread with my non-existent lock powers! :-D

Posted: Sat Apr 29, 2006 8:17 pm
by Benjamin
Keep it serious guys.

http://www.php.net/register_globals

Can be turned on or off in php.ini

Posted: Sat Apr 29, 2006 8:17 pm
by Jade
Lol. I consider it a problem beacuse I'm too lazy to type up anymore extra code

Posted: Sat Apr 29, 2006 8:19 pm
by Charles256
umm..... google "Why is register globals the devil" and it will explain why it is the devil. Seriously. Some serious issues can arise. Just thought you should know.