 |
| Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 16th, 2004, 09:05 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
newbie
anyone - help please.
i am a reasonably experienced visual objects programmer, but php is doing my head in as they say.
i copied some code from the manual: it does'nt work
<?php
import_request_variables('p', 'F_');
print "$F_REFBACK \n";
// the \n doesn't as they say
// from the manual
print "This spans\nmultiple lines. The newlines will be\noutput as well.";
// well it doesn't - all on one line.
print "$F_WHATDONE ";
.....
regards
|
|

July 16th, 2004, 10:02 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Are there input elements in the form with the names/id "REFBACK" and "WHATDONE"? If so, is the form being POSTed?
A call to:
import_request_variables('p', 'F_');
Simply extracts all the posted values and appends an F-underscore to their names (which seems as useful as a chocolate teapot, to my way of thinking, but maybe it has some greater signifiance within the example you are reading). Which manual is this, anyway? the online manual doesn't list it...
Take it easy
Dan
|
|

July 16th, 2004, 10:13 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dan
thanks for the reply.
the question is why isn't the /n working ?
to see details of the php setup i am using run
http://www.tdoc.org.uk/huj11k933he3/...n/tdocrtr1.php
someone needs to write a decent beginners manual !
after about three hours struggling with very basic and wholly undocumented syntax i wrote as simailar and it works...
print( "Reference: $F_RESPONSE<BR>"); // entered reference
this seems to put the CRLF in properly
lets hope it works when i change this code to create a text file.
r
|
|

July 16th, 2004, 12:40 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
With TEXT files, you must use \n. You *can* use \n for writing to a .php page, but you'll have to convert the \ns to <br/>s with a function like nl2br().
$variable = "this\nspans\nmore\nthan\none\nline";
echo nl2br($variable);
HTH,
Snib
<><
|
|

July 17th, 2004, 04:26 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
snib
thank you very much for that simple answer.
may be the php manual could be updated....
r
|
|

July 17th, 2004, 04:46 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
still somethoing funny going on....
so here's the code
$att_content .= "$tdoc_edi/n" ;
$att_content .= "$tdoc_ver/n" ;
$att_content .= "Despatched by: TDOC php script/n" ;
$att_content .= "Despatch Date: $today<BR>" ;
$att_content .= "SENDMODE: $tdoc_mode<BR>" ;
and here's the output.
TDOC EDI General Document/n426/nDespatched by: TDOC php script/nDespatch Date: 17/07/04
SENDMODE: Response
DOCSTART
Job Title: NDGH
so the BR's work, but the /n doesn't
please explain.
i want to generate this text and then email it as an attachment.
regards
|
|

July 17th, 2004, 04:51 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry i meant to use \n's but still no CRLF inserted ??
WHY NOT ?
|
|

July 17th, 2004, 05:19 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry I didn't get to look at this again yesterday. You've got a lot of things going on on that Cobalt server, haven't you...
I'm a little confused by what you are trying to achieve. If you are struggling to obtain "CRLF"s (by which I take it you mean Visual basic style 'VBCRLF's) part of the trouble may be that you are only specifying a newline by inserting a '\n'. CRLF, on the other hand ('Carriage Return and Line Feed') is just that, a carriage return (represented by the escape-sequence '\r' in C-like languages like PHP) and a line feed: i.e. '\r\n'.
(Good grief! Your website's just offered me a free mouse mat!)
In Unix environments, only the '\n' is needed, but Windows uses both '\r\n' sequence to represent the end of a line. That may be part of your battle, but I still don't quite get what you are trying to achieve. Like I say, you're not getting "carriage return [i]&[/] line feed" simply because you're not specifying it.
Sorry I can't be much more help, with what you've told us so far.
Dan
|
|

July 18th, 2004, 05:40 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Daniel
Sorry we are out of mouse mats (and have been for 5 years) - but its always better to have an offer !
thanks for the reply as well. we have an existing script that sends the data, but not in the neseaary EDI format (as developed by the UK's CITE => Construction Industry Trading Electronically).
did you see the section: Overview -> QuickLook -> General Documents -> EDI ? What I are trying to do is to generate the TGN file, shown as a txt one on the web site.
regards
richard
|
|

July 19th, 2004, 05:01 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, is the problem simply the newlines, and if so, does using '\r\n' instead of just '\n' solve it?
dan
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Please help the newbie!! |
shelly.aix |
Visual Basic 2008 Essentials |
2 |
December 16th, 2008 07:35 AM |
| Newbie help... |
mkruger |
XSLT |
7 |
October 24th, 2007 02:33 AM |
| Newbie here |
jmac731976 |
HTML Code Clinic |
13 |
August 29th, 2007 03:54 PM |
| Newbie please help |
indyanguy |
XSLT |
1 |
September 2nd, 2005 09:18 AM |
| Newbie Help! |
TheShadow |
Javascript |
1 |
March 21st, 2005 03:42 AM |
|
 |