barryc Posted November 24, 2006 Share Posted November 24, 2006 Hi All,I need some help please with formatting output such that it appears inline (eg Arrival Date: 15 May 2007) rather than the existing three line output when sent via email. Thanks, Barry***Output form***$arrival_day = $_POST['select1'] ;$arrival_month = $_POST['select2'] ;$arrival_year = $_POST['select3'] ;..."Arrival Date: $select1\n" ."Arrival Month: $select2\n" ."Arrival Year: $select3\n" .... Link to comment https://forums.phpfreaks.com/topic/28294-help-required-formatting-output-string/ Share on other sites More sharing options...
mansuang Posted November 24, 2006 Share Posted November 24, 2006 you can use the string concatenation operator "." which returns the concatenation Example:$arrival = $_POST['select1']." ".$_POST['select2']." ".$_POST['select3'] ;More detail about String Operators[url=http://www.phpfreaks.com/phpmanual/page/language.operators.string.html]http://www.phpfreaks.com/phpmanual/page/language.operators.string.html[/url] Link to comment https://forums.phpfreaks.com/topic/28294-help-required-formatting-output-string/#findComment-129395 Share on other sites More sharing options...
Stooney Posted November 24, 2006 Share Posted November 24, 2006 [code]$arrival_day = $_POST['select1'] ;$arrival_month = $_POST['select2'] ;$arrival_year = $_POST['select3'] ;echo "Arrival Date: $select1 $select2 $select3";[/code]yea? or if you need it to output 1 way to a page or format it to 1 line for email, just use if statements or whatever floats your boat. Link to comment https://forums.phpfreaks.com/topic/28294-help-required-formatting-output-string/#findComment-129399 Share on other sites More sharing options...
barryc Posted November 24, 2006 Author Share Posted November 24, 2006 Wow!! Very imprressed with the speed of response to my question. Thank you both very much indeed for your input. I had looked under PHP String Operators but was expecting to see concatenation, and I had tried a variation of the second option (with and without commas!) but did not appreciate the use of the echo command. Very helpful guys, thanks again. Kind Regards, Barry Link to comment https://forums.phpfreaks.com/topic/28294-help-required-formatting-output-string/#findComment-129412 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.