Can you make this word wrap?

Reply

Join Date: Oct 2008
Posts: 4
Reputation: benjamindemers is an unknown quantity at this point 
Solved Threads: 0
benjamindemers benjamindemers is offline Offline
Newbie Poster

Can you make this word wrap?

 
0
  #1
Oct 24th, 2008
Hey folks,

Anyone know how to take the code below and make sure that all the stuff that gets sent to the email wordwraps at 400 pixels? Please HELP!

  1.  
  2. <?php
  3.  
  4. $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
  5.  
  6. session_start();
  7. if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
  8. $message = wordwrap($message, 70);
  9. mail("rbeale@bealeinc.com,iam1az@cox.net","Membership Application","Form data:
  10.  
  11. First Name: " . $_POST['field_1'] . "
  12. Last Name: " . $_POST['field_2'] . "
  13. Your Email Address: " . $_POST['field_3'] . "
  14. Street Address: " . $_POST['field_4'] . "
  15. City: " . $_POST['field_5'] . "
  16. State: " . $_POST['field_6'] . "
  17. Zip Code: " . $_POST['field_7'] . "
  18. Home Phone: " . $_POST['field_8'] . "
  19. Work Phone: " . $_POST['field_9'] . "
  20. Cell Phone: " . $_POST['field_10'] . "
  21. Name of Emergency Contact: " . $_POST['field_11'] . "
  22. Phone of Emergency Contact: " . $_POST['field_12'] . "
  23. Relationship To You: " . $_POST['field_13'] . "
  24. Brief History of Yourself: " . $_POST['field_14'] . "
  25. Make of Motorcycle You Own: " . $_POST['field_15'] . "
  26. Model of Motorcycle you Own: " . $_POST['field_16'] . "
  27. Year of Motorcycle You Own: " . $_POST['field_17'] . "
  28. Years of Riding Experience: " . $_POST['field_18'] . "
  29. State Reason For Joining: " . $_POST['field_19'] . "
  30.  
  31.  
  32.  
  33.  
  34. ");
  35.  
  36. include("confirm.html");
  37. }
  38. else {
  39. echo "Invalid Captcha String.";
  40. }
  41.  
  42. ?>

Thanks

Benjamin
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,602
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: Can you make this word wrap?

 
1
  #2
Oct 24th, 2008
While you can wrap at a certain amount of characters in plain text emails, I'm not certain about the ability to wrap at exactly 400 pixels.

What you can do is send and html email instead, and put the text inside a container that is set to 400 pixels wide.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Can you make this word wrap?

 
0
  #3
Oct 24th, 2008
Here is a thread on wordwrap if you decide to go that direction:
http://www.daniweb.com/forums/thread151130.html
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 4
Reputation: benjamindemers is an unknown quantity at this point 
Solved Threads: 0
benjamindemers benjamindemers is offline Offline
Newbie Poster

Re: Can you make this word wrap?

 
-1
  #4
Oct 27th, 2008
Originally Posted by benjamindemers View Post
Hey folks,

Anyone know how to take the code below and make sure that all the stuff that gets sent to the email wordwraps at 400 pixels? Please HELP!

  1.  
  2. <?php
  3.  
  4. $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
  5.  
  6. session_start();
  7. if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
  8. $message = wordwrap($message, 70);
  9. mail("rbeale@bealeinc.com,iam1az@cox.net","Membership Application","Form data:
  10.  
  11. First Name: " . $_POST['field_1'] . "
  12. Last Name: " . $_POST['field_2'] . "
  13. Your Email Address: " . $_POST['field_3'] . "
  14. Street Address: " . $_POST['field_4'] . "
  15. City: " . $_POST['field_5'] . "
  16. State: " . $_POST['field_6'] . "
  17. Zip Code: " . $_POST['field_7'] . "
  18. Home Phone: " . $_POST['field_8'] . "
  19. Work Phone: " . $_POST['field_9'] . "
  20. Cell Phone: " . $_POST['field_10'] . "
  21. Name of Emergency Contact: " . $_POST['field_11'] . "
  22. Phone of Emergency Contact: " . $_POST['field_12'] . "
  23. Relationship To You: " . $_POST['field_13'] . "
  24. Brief History of Yourself: " . $_POST['field_14'] . "
  25. Make of Motorcycle You Own: " . $_POST['field_15'] . "
  26. Model of Motorcycle you Own: " . $_POST['field_16'] . "
  27. Year of Motorcycle You Own: " . $_POST['field_17'] . "
  28. Years of Riding Experience: " . $_POST['field_18'] . "
  29. State Reason For Joining: " . $_POST['field_19'] . "
  30.  
  31.  
  32.  
  33.  
  34. ");
  35.  
  36. include("confirm.html");
  37. }
  38. else {
  39. echo "Invalid Captcha String.";
  40. }
  41.  
  42. ?>

Thanks

Benjamin
I think you have misunderstood what I wanted or don't know how to do this. It should be simple for someone who knows php to come up with a fix on this code to make the email it generates word wrap.

To restate: I want this code that sends an email to have the results that it generates within the email WORD WRAP at 100 characters including spaces.

HELP!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: Can you make this word wrap?

 
0
  #5
Oct 27th, 2008
Take a look at the wordwrap function in PHP:
http://uk.php.net/wordwrap
  1. wordwrap($text, 100, "<br />\n", true);
Last edited by Will Gresham; Oct 27th, 2008 at 11:30 pm.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 4
Reputation: benjamindemers is an unknown quantity at this point 
Solved Threads: 0
benjamindemers benjamindemers is offline Offline
Newbie Poster

Re: Can you make this word wrap?

 
0
  #6
Oct 28th, 2008
So are you saying that I have to define the text that is wrapped before it will wrap it? In this case the input variables are always different. They are putting in things like address and reasons for joining. These will never be constant.

What do you do in the case listed above to make an unknown variable text wordwrap at such and such column width? Please use the php exactly as listed.

Excellent resource by the way this PHP library. Problem is I don't know PHP yet. I want to learn it but I have this pressing problem that needs solving now.

Please continue to help me figure this out.

Benjamin
Last edited by benjamindemers; Oct 28th, 2008 at 12:54 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC