Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need help again with PHP, need to remove spaces from an email sent out.
Old 11-07-2007, 12:09 PM Need help again with PHP, need to remove spaces from an email sent out.
Novice Talker

Posts: 5
Name: mike
Trades: 0
Ok so I have a mailing list and the php is sending out an email to everyone. However the spaces in between the name and address etc are alittle too big. I was hoping I could remove the spaces some how.

I know there is a function to do this or something but I dont know what, and where do I put this function?

Plz help.

Thanks.
Bardin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-07-2007, 12:27 PM Re: Need help again with PHP, need to remove spaces from an email sent out.
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Trades: 0
What is your starting code? I'm not sure exactly which spaces you mean.
__________________
Foundation Flash tutorials :
Please login or register to view this content. Registration is FREE


New Dreamed Up Web Design:
Please login or register to view this content. Registration is FREE
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 11-07-2007, 12:33 PM Re: Need help again with PHP, need to remove spaces from an email sent out.
Novice Talker

Posts: 5
Name: mike
Trades: 0
this is the code on my php page


<?php
error_reporting(E_ALL ^ E_NOTICE);

require_once("includes/functions.mysql.php");
require_once("includes/config.php");


$posted=$_POST;
array_walk($posted, "postSanitize");

$formname=$posted["formname"];

if ($formname == "") {
// we have nothing to process, bail
exit;
}


dbconnect();

switch($formname){

case "demo":

$sql="insert into demo values(
'',
".sql_quoted($posted["name"]).",
".sql_quoted($posted["company"]).",
".sql_quoted($posted["address"]).",
".sql_quoted($posted["city"]).",
".sql_quoted($posted["province"]).",
".sql_quoted($posted["postal_code"]).",
".sql_quoted($posted["phone"]).",
".sql_quoted($posted["country"]).",
".sql_quoted($posted["email"]).",
".sql_quoted($posted["fax"]).",
".sql_quoted($posted["facility"]).",
".sql_quoted($posted["units"]).",
".sql_quoted($posted["how"]).",
".sql_quoted($posted["comments"]).",
".sql_quoted($posted["method"])."
)";

$completed=mysql_query($sql);



/* start demo mail details */
$mailto = "myemail@email.com";
$mailfrom = "support@windmill-software.com";
$subject = "PM Worx Demo Request";

$body="";
$body.="Name: ".$posted["name"]."\r\n";
$body.="Company: ".$posted["company"]."\r\n";
$body.="Address: ".$posted["address"]."\r\n";
$body.="City: ".$posted["city"]."\r\n";
$body.="Province/State: ".$posted["province"]."\r\n";
$body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";
$body.="Phone: ".$posted["phone"]."\r\n";
$body.="Country: ".$posted["country"]."\r\n";
$body.="Email: ".$posted["email"]."\r\n";
$body.="Fax: ".$posted["fax"]."\r\n";
$body.="Type of Facility: ".$posted["facility"]."\r\n";
$body.="# of Units: ".$posted["units"]."\r\n";
$body.="How: ".$posted["how"]."\r\n";
$body.="Comments: ".$posted["comments"]."\r\n";
$body.="Chosen Method: ".$posted["method"]."\r\n";
/* end demo mail details */

# send email notification and capture result (true/false)
$notified=notifyByEmail($mailto,$subject,$body,$ma ilfrom);


if ($completed) {
# sql worked, this is the message that displays on page for a success

# a limiter against $notified being set true can be placed here if desired/required at some point ... if $notified is not set to true then the notification email did not send properly

# pick appropriate message dependong on the method of delivery chosen by user in form
switch($posted["method"]) {
case "download":
# this is the message that displays on page for a success for download
$message='<img src="http://www.webmaster-talk.com/images/thankyou_democd.gif" width="239" height="49"><br /><br />
<a href="Downloads/Current/PMW.exe"><img src="http://www.webmaster-talk.com/images/logo_demo.gif" alt="Click here to download your Demo" /></a>
<p>We have received your request for a PM Worx demo download.&nbsp;&nbsp;To download the demo, <A HREF="Downloads/Current/PMW.exe">click here</A>.&nbsp;&nbsp;
Remember, you will need to contact Windmill in order to register the demo after it has been installed.</p>
';
break;

case "mail":
# this is the message that displays on page for a success for mailed CD
$message='<img src="http://www.webmaster-talk.com/images/thankyou_democd.gif" width="239" height="49"><br /><br />

<p>We have received your request for a PM Worx demo CD.&nbsp;&nbsp;You should receive the CD in the mail in a few days.&nbsp;&nbsp;
Remember, you will need to contact Windmill in order to register the demo after it has been installed.</p>
';
break;
}

} else {
# there was an error processing sql, inform user to try again or request assistance
$message='There was an error processing your demo request. Please hit the back button in your browser and try again. If the problem persists please contact us directly for your demo request.';
}

break;


case "subscribe":

$sql="insert into subscribe values(
'',
".sql_quoted($posted["name"]).",
".sql_quoted($posted["company"]).",
".sql_quoted($posted["title"]).",
".sql_quoted($posted["city"]).",
".sql_quoted($posted["address"]).",
".sql_quoted($posted["postal_code"]).",
".sql_quoted($posted["province"]).",
".sql_quoted($posted["country"]).",
".sql_quoted($posted["phone"]).",
".sql_quoted($posted["email"]).",
".sql_quoted($posted["referred"]).",
".sql_quoted($posted["referrername"])."
)";

$completed=mysql_query($sql);

/* start subscribe mail details */
$mailto = "myemail@email.com";
$mailfrom = "worxwire@windmill-software.com";
$subject = "WorxWire Subscription";

$body="";
$body.="Name: ".$posted["name"]."\r\n";
$body.="Company: ".$posted["company"]."\r\n";
$body.="Title/Position: ".$posted["title"]."\r\n";
$body.="Address: ".$posted["address"]."\r\n";
$body.="City: ".$posted["city"]."\r\n";
$body.="Province/State: ".$posted["province"]."\r\n";
$body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";
$body.="Phone: ".$posted["phone"]."\r\n";
$body.="Country: ".$posted["country"]."\r\n";
$body.="Email: ".$posted["email"]."\r\n";
$body.="Referred?: ".$posted["referred"]."\r\n";
$body.="Referred By: ".$posted["referrername"]."\r\n";
/* end subscribe mail details */

# send email notification and capture result (true/false)
$notified=notifyByEmail($mailto,$subject,$body,$ma ilfrom);

if ($completed) {
# sql worked, this is the message that displays on page for a success
$message='<p>Thank you. You are now subscribed.</p>
<p>Watch your inbox for the next edition of the WorxWire.</p>
';
} else {
# there was an error processing sql, inform user to try again
$message='There was an error processing your subscription. Please hit the back button in your browser and try again. If the problem persists please contact us.';
}

require_once("includes/pagetop.php");

echo $message;

require_once("includes/pagebottom2.php");

break;

case "user_conference":


$sql="insert into user_conference values(
'',
".sql_quoted($posted["name"]).",
".sql_quoted($posted["company"]).",
".sql_quoted($posted["title"]).",
".sql_quoted($posted["city"]).",
".sql_quoted($posted["address"]).",
".sql_quoted($posted["postal_code"]).",
".sql_quoted($posted["province"]).",
".sql_quoted($posted["country"]).",
".sql_quoted($posted["phone"]).",
".sql_quoted($posted["email"])."
)";
#echo $sql;

$completed=mysql_query($sql);


/* start user_conference mail details */
$mailto = "myemail@email.com";
$mailfrom = "support@windmill-software.com";
$subject = "2007 User Conference Registration";

$body="";
$body.="Name: ".$posted["name"]."\r\n";
$body.="Company: ".$posted["company"]."\r\n";
$body.="Title/Position: ".$posted["title"]."\r\n";
$body.="Address: ".$posted["address"]."\r\n";
$body.="City: ".$posted["city"]."\r\n";
$body.="Province/State: ".$posted["province"]."\r\n";
$body.="Postal Code/Zip: ".$posted["postal_code"]."\r\n";
$body.="Phone: ".$posted["phone"]."\r\n";
$body.="Country: ".$posted["country"]."\r\n";
$body.="Email: ".$posted["email"]."\r\n";
/* end user_conference mail details */

# send email notification and capture result (true/false)
$notified=notifyByEmail($mailto,$subject,$body,$ma ilfrom);

if ($completed) {
# sql worked, this is the message that displays on page for a success
$message="<p>Thank you. Your registration will be confirmed shortly.</p>
<p>See you September 18th!</p>";
} else {
# there was an error processing sql, inform user to try again
$message='There was an error processing your demo registration. Please hit the back button in your browser and try again. If the problem persists please contact us directly.';
}

break;



}

dbclose();


# and Lastly, we display the HTMLpage with the message we loaded earlier
require_once("includes/pagetop.php");

echo $message;

include("includes/pagebottom2.php");

?>

basically someone signs up for something and an email is sent to myemail@email.com displaying the persons information, but when it gets sent to me, the spaces inbetween name and address are large, im attempting to remove those spaces.

Last edited by Bardin; 11-07-2007 at 12:34 PM..
Bardin is offline
Reply With Quote
View Public Profile
 
Old 11-07-2007, 02:40 PM Re: Need help again with PHP, need to remove spaces from an email sent out.
Novice Talker

Posts: 5
Name: mike
Trades: 0
anyone know?
Bardin is offline
Reply With Quote
View Public Profile
 
Old 11-13-2007, 11:30 PM Re: Need help again with PHP, need to remove spaces from an email sent out.
Novice Talker

Posts: 13
Trades: 0
why not send the message in HTML it will give you far more control over formatting.
__________________

Please login or register to view this content. Registration is FREE
- Find your Stuff!

Please login or register to view this content. Registration is FREE
- Merchant Accounts for Business

Please login or register to view this content. Registration is FREE
- ECommerce Solutions
ericsante is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need help again with PHP, need to remove spaces from an email sent out.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40397 seconds with 12 queries