PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 7th, 2012, 06:07 AM
hudbarnett hudbarnett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Edinburgh
Posts: 19 hudbarnett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 19 m
Reputation Power: 0
PHP-General - Echo tables

Hi there

I'm working on a feedback form that sends a copy of the content to the sender. In the email it lists the following and prints it out. How would i take the following information and lay it out into a table using the echo command?

PHP Code:
 $message 'Name: '.$name.
Email: '
.$mailFrom.
Telephone: '
.$telephone.
Address: '
.$address.
Message: '
.$message_text


Thanks

Hudbarnett

Reply With Quote
  #2  
Old December 7th, 2012, 06:57 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,907 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Month 1 Day 12 h 27 m 53 sec
Reputation Power: 581
If the objective is to put a table in an email, you wouldn't echo anything. You need to build the email using something like PHPMailer.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old December 7th, 2012, 07:02 AM
hudbarnett hudbarnett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Edinburgh
Posts: 19 hudbarnett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 19 m
Reputation Power: 0
Quote:
Originally Posted by gw1500se
If the objective is to put a table in an email, you wouldn't echo anything. You need to build the email using something like PHPMailer.


Ah, i thought that by placing a table around the code would display it in a table format in the email. I have seen some example on how to do this but so far I've had no luck and haven't been able to get it working.

Thanks for your reply.

Hudbarnett

Reply With Quote
  #4  
Old December 7th, 2012, 08:05 AM
Northie's Avatar
Northie Northie is offline
Square Peg in a Round Hole
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2007
Location: North Yorkshire, UK
Posts: 3,440 Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 14 h 37 m
Reputation Power: 3896
Quote:
Originally Posted by hudbarnett
How would i take the following information and lay it out into a table using the echo command?


Exactly the same as if you were building it for a webpage but instead of echo, use variable concatenation,

eg

PHP Code:
//
echo "<table>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"</table>"


becomes

PHP Code:
//
$output.="<table>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="</table>"


if you're going from existing source code to new, do a find and replace for "echo" and replace with "$output.=" (without quotes )

Then, use a library like PHPMailer (see gw1500se's post) to build and send an HTML email (using the html that's in your $output variable);

If you really really really wanted to use echo then you'd want to wrap output buffers around the relevant echo statements and then collect the contents into a variable which you would then pass into PHPMailer to send an html email
__________________
PHP OOPS! <?php Output::Render(DB::Execute(SQL::makeFrom($_GET),$_GET)->fetchArray(),Template::getInstance('default')); ?>

PDO vs mysql_* functions: Find a Migration Guide Here

[ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

Reply With Quote
  #5  
Old December 7th, 2012, 08:40 AM
hudbarnett hudbarnett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Edinburgh
Posts: 19 hudbarnett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 19 m
Reputation Power: 0
Quote:
Originally Posted by Northie
Exactly the same as if you were building it for a webpage but instead of echo, use variable concatenation,

eg

PHP Code:
//
echo "<table>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"<tr><td>....</td><td>....</td></tr>";
echo 
"</table>"


becomes

PHP Code:
//
$output.="<table>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="<tr><td>....</td><td>....</td></tr>";
$output.="</table>"


if you're going from existing source code to new, do a find and replace for "echo" and replace with "$output.=" (without quotes )

Then, use a library like PHPMailer (see gw1500se's post) to build and send an HTML email (using the html that's in your $output variable);

If you really really really wanted to use echo then you'd want to wrap output buffers around the relevant echo statements and then collect the contents into a variable which you would then pass into PHPMailer to send an html email


Hi there

Thank you for pointing me in the right direction, i'm going to give it a go and see how i get on.

Thank you

Hudbarnett

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Echo tables

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap