943,846 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1890
  • PHP RSS
Oct 24th, 2008
0

Can you make this word wrap?

Expand 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!

PHP Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
benjamindemers is offline Offline
4 posts
since Oct 2008
Oct 24th, 2008
1

Re: Can you make this word wrap?

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.
Featured Poster
Reputation Points: 975
Solved Threads: 140
Posting Virtuoso
scru is offline Offline
1,624 posts
since Feb 2007
Oct 24th, 2008
0

Re: Can you make this word wrap?

Here is a thread on wordwrap if you decide to go that direction:
http://www.daniweb.com/forums/thread151130.html
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 27th, 2008
-1

Re: Can you make this word wrap?

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!

PHP Syntax (Toggle Plain Text)
  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!
Reputation Points: 9
Solved Threads: 0
Newbie Poster
benjamindemers is offline Offline
4 posts
since Oct 2008
Oct 27th, 2008
0

Re: Can you make this word wrap?

Take a look at the wordwrap function in PHP:
http://uk.php.net/wordwrap
php Syntax (Toggle Plain Text)
  1. wordwrap($text, 100, "<br />\n", true);
Last edited by Will Gresham; Oct 27th, 2008 at 11:30 pm.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Oct 28th, 2008
0

Re: Can you make this word wrap?

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.
Reputation Points: 9
Solved Threads: 0
Newbie Poster
benjamindemers is offline Offline
4 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC