nofx1728 Posted May 11, 2007 Share Posted May 11, 2007 I can not figure this out and I'm starting to get really frustrated. I tried going through your sample code and that didn't work either. If a field isn't filled out properly the error message comes up as intended, and after I submit the form it redirects me to the correct website as intended. However, the email of the form information is never being sent back to me. Can someone please help me. Here is my code: <?php // Receiving variables $item_name = addslashes($_POST['item_name']); $quantity = addslashes($_POST['quantity']); $amount = addslashes($_POST['amount']); $firstname = addslashes($_POST['firstname']); $lastname = addslashes($_POST['lastname']); $address1 = addslashes($_POST['address1']); $address2 = addslashes($_POST['address2']); $city = addslashes($_POST['city']); $state = addslashes($_POST['state']); $zip = addslashes($_POST['zip']); $company = addslashes($_POST['company']); $occupation = addslashes($_POST['occupation']); $email = addslashes($_POST['email']); $phone1 = addslashes($_POST['phone1']); $phone2 = addslashes($_POST['phone2']); $phone3 = addslashes($_POST['phone3']); $phonetype = addslashes($_POST['phonetype']); // Validation if ( $amount < 0) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if ( $amount > 500) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($amount) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($firstname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($lastname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($address1) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($city) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) >30) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($zip) <5) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) >10) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($occupation) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($email) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($phone1) <3) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) >3) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } //Sending Email to form owner $pfw_header = "From: $email\r\n"; $pfw_subject = "form test"; $pfw_email_to = "nofx1727@yahoo.com"; $pfw_message = "item_name: $item_name\r\n" . "quantity: $quantity\r\n" . "amount: $amount\r\n" . "firstname: $firstname\r\n" . "lastname: $lastname\r\n" . "address1: $address1\r\n" . "address2: $address2\r\n" . "city: $city\r\n" . "state: $state\r\n" . "zip: $zip\r\n" . "company: $company\r\n" . "occupation: $occupation\r\n" . "email: $email\r\n" . "phone1: $phone1\r\n" . "phone2: $phone2\r\n" . "phone3: $phone3\r\n" . "phonetype: $phonetype\r\n"; mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ); header("Location: https://www.paypal.com/cgi-bin/webscr"); ?> Quote Link to comment Share on other sites More sharing options...
StormTheGates Posted May 11, 2007 Share Posted May 11, 2007 Are you sure your mail SMTP server is running and working on your server? Quote Link to comment Share on other sites More sharing options...
nofx1728 Posted May 11, 2007 Author Share Posted May 11, 2007 I'm pretty sure it is. Quote Link to comment Share on other sites More sharing options...
taith Posted May 11, 2007 Share Posted May 11, 2007 didja check your antispam? Quote Link to comment Share on other sites More sharing options...
nofx1728 Posted May 11, 2007 Author Share Posted May 11, 2007 Ok... this is probably the dumbest question anyone has ever written... but I just got off the phone with godaddy and they said I need to switch my hosting from windows to linux in order for the script to work. 1. I thought php could be used by almost any hosting (am I wrong?) 2. If I have to use linux hosting for my php script to work then why would the redirect in my php script be working? thanks, nofx1728 Quote Link to comment Share on other sites More sharing options...
per1os Posted May 11, 2007 Share Posted May 11, 2007 With mailing features Windows generally does not support it without an SMTP server. Linux comes with sendmail be default, where as with windows you would have to setup exchange or something along those lines. Which is why most hosting companies who have hosting on windows do not support the mail feature with windows because it is a pain in the ass to setup. That is all they are trying to say. Quote Link to comment Share on other sites More sharing options...
nofx1728 Posted May 11, 2007 Author Share Posted May 11, 2007 Thank you very much that clears things up. I've never worked with linux hosting, is it difficult? Sorry for going off topic here I'm just struggling to get this to work . Quote Link to comment Share on other sites More sharing options...
per1os Posted May 11, 2007 Share Posted May 11, 2007 For me no, it is a ton easier than windows. SSH is Wonderful if you have that functionality for your linux server. Quote Link to comment Share on other sites More sharing options...
chigley Posted May 11, 2007 Share Posted May 11, 2007 Hehe I've only recently got a server with SSH and it's great! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.