PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
what happens if you change the 20 in that statement to 0 ?
the formatting is no longer centred BUT some of the feilds are side by side and some are underneath each other
[text]We have received the following information:
Title: Mr
Full Name:
Telephone Number: test12
Mobile Number: test12
Email Address: test@website.co.uk
Preferred method of contact: Telephone
Current Address: test12
Where are you interested in renting: anywhere What is the maximum rental payment per month: test12 What sort of property are you interested in: House
Smoker: no
Employment status: Unemployed
How many people will live in the property: 1 How many children: 1 Intended moving in date: 17 Intended moving in month: Feb Intended moving in year: 2014 Have you funds available: No
[/text]
It appears that the formatting is the way you want it, up through the "current address" information, using social-experiment's suggestion. The remainder of the output, which is improperly formatted, doesn't seem to be coming from the code you provided to us. Where is it coming from???
re the formatting; try putting a new line at the end of the data instead of in front of it. You could easily turn the output into html and use <br /> or css for the layout of the email if you wanted to.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Thanks the formatting has been sorted, looks fine now
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("\n%0s: %s\n",$b,$_REQUEST[$a]); }
with regards to the other issues i have of "sanitize" i am trying to figure out what it currently is so a bit worrying. I am reading the links you sent me
Because the $from value comes from the user, i'm guessing it is their email address, it can contain data which might turn your server into one that sends out lots of spam. Have a look at the url below; it explains the concept of email header injection. Just a note, if you are getting this data from a form, use $_POST instead of $_REQUEST.