Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17301
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "J.O. Aho" <user@example.net> |
| Newsgroups | comp.lang.php |
| Subject | Re: New line in php not working |
| Date | Sun, 29 Jan 2017 09:30:05 +0100 |
| Lines | 50 |
| Message-ID | <ef5ngdFu924U1@mid.individual.net> (permalink) |
| References | <0157ce84-974d-407e-9a25-c66e8ceba904@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net rPkKwG4XfqQOohfR4FBcJw5+V0WOlSX0fBorXlNrCV/qzETBvr |
| Cancel-Lock | sha1:XnWAJN/i68N6QkUS3AcLCJdeVSc= |
| X-Enigmail-Draft-Status | N1110 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
| In-Reply-To | <0157ce84-974d-407e-9a25-c66e8ceba904@googlegroups.com> |
| Xref | csiph.com comp.lang.php:17301 |
Show key headers only | View raw
On 01/29/17 03:24, wart2ww wrote:
> The following code all works fine in a <?php ?> block except the \n is not working.
> All the fields in the in the email are on one line.
This has nothing to do with "\n" not working, this is the way the mail
client handles the "\n", for example the terrible mail client outlook
will show all in one line, you will need to have "\t\n\n" for it to
handle this correctly, while the nice Thunderbird will show it as
intended as it is with "\n".
> I have done this before and it seemed to work but not now. What have I done wrong?
>
> foreach ($_POST as $key => $value) {
>
> if (isset($fields[$key])) {
> $emailText .= "$fields[$key]: $value\n"; }
> }
For more readability of your code, you should stick with a coding
standard and make variables in a string to stand out
foreach ($_POST as $key => $value) {
if (isset($fields[$key])) {
$emailText .= "${fields[$key]}: ${value}\n";
}
}
or
foreach ($_POST as $key => $value) {
if (isset($fields[$key])) {
$emailText .= $fields[$key] .": ". $value ."\n";
}
}
> Thank you for your help.
np.
--
//Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New line in php not working wart2ww <fcc@bmi.net> - 2017-01-28 18:24 -0800
Re: New line in php not working "J.O. Aho" <user@example.net> - 2017-01-29 09:30 +0100
Re: New line in php not working Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-29 15:10 +0100
Re: New line in php not working wart2ww <fcc@bmi.net> - 2017-01-29 18:02 -0800
Re: New line in php not working wart2ww <fcc@bmi.net> - 2017-01-29 18:04 -0800
Re: New line in php not working Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-29 21:14 -0500
Re: New line in php not working wart2ww <fcc@bmi.net> - 2017-01-29 18:56 -0800
Re: New line in php not working Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-29 22:08 -0500
Re: New line in php not working wart2ww <fcc@bmi.net> - 2017-01-29 19:40 -0800
Re: New line in php not working Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-30 07:41 -0500
Re: New line in php not working Angel <he1983912@gmail.com> - 2022-06-30 07:42 -0700
csiph-web