from the php manual:
mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )
Just a starter for 10: why have you set up all your $cust_* parameters then not used them?
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
change your mail line to:
mail("info@***.com","Contact Me Please","This is a sample message");
forget the rest of the cust_first_name, cust_last_name, etc..
Try that and see what results you get. You should recieve an email with "This is a sample message" as the message text.
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
good, so everything seems to be set up ok. Now, change the "mail" line to something like:
mail("info@***.com","Contact Me Please","first name: $cust_first_name, last name: $cust_last_name, email: $cust_email");
Try again, and see what you get.
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
In that case the script that you've shown above isn't receiving the input data properly. What does the code for your contact form look like?
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
I'm stabbing about blindly in the dark here as I can't see the rest of the code.
Change "row[cust_first_name]" to simply "cust_first_name"
and tell me what happens.
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
Ah. Glad it worked. Glad you worked out what to do for the rest of the fields.
As for the formatting, you need to format the text that you put in the third parameter of the mail function. http://uk.php.net/manual/en/function.mail.php has some examples, and it also explains how to adjust the headers in the emails.
BE AWARE of the fact that you are accepting untested user input - people can easily attack your system as it stands. For a secure system you need to carefully vet all inputs.
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1
First rule of thumb: Always check any inputs you get from external sources. This means, in your case, the input that users put into your form. People could be entering absolutely anything, and if they play around enough with their entries, then they could produce some unexpected results in your code.
The way to protect against this is to comprehensively check any data you get by checking that it conforms to any expectations you have for entries. Names shouldn't contain a ";", for example, and no field should be over a particular length.
The example at the link I gave you is mentioned by "jfonseca at matarese dot com" (search for the name, and you'll find the comment) and is just one more form of the very common "injection"; I expect there are many more.
This is just basic security, and the depth you want to go with it depend entirely on the applications that your code will have. If you're on an intranet and you know that no malicious users can access the form, then you might feel comfortable leaving out security altogether. If you're storing peoples' credit card details on an world accessible site, then you'll be needing some pretty intensive security.
leelee
Junior Poster in Training
77 posts since Aug 2005
Reputation Points: 31
Solved Threads: 1