PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 16th, 2004, 12:08 PM
Slash5 Slash5 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 Slash5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can't email anything in double quotes

Hi,

This is really annoying cos it seems so easy.
I've created two php files: One with a form, and the second with a preview page that displays the submitted data from that form. The second file also contains a mail function which is called when the user clicks send if they're happy with the preview. Then the submitted data gets sent to my email address. Pretty straight forward, right?

My problem happens if the user has written something that contains double quotes when they filled out the form. Anything between double quotes AND after will not display when the data is emailed to me. WHY?

Single quotes work fine. It's just the double quotes.

EXAMPLE

If the user writes:
Hello there "how are you" ?

All I get sent is:
Hello there

This is the contents of the mail function that sends the email:

PHP Code:
function feedback_send(){

global 
$username$useremail$userphone$comments;

$mailto "myname@somewhere.com"
$subject "Website feedback"
$message "This Feedback was sent by:\n" 
"$username\n" 
"---------Website Feedback and Enquiries---------\n\n" 
"Website user name:\n" ."$username" 
"\nWebsite user email address is: \n" " $useremail" 
"\nWebsite user phone number:\n" "$userphone" 
"\nFeedback:\n" "$comments" 
"\n\n------------------------------------------------------------\n" 


$success mail($mailto$subject$message"From: \"$username\"<$useremail>\nReply-To: \"$username\" <$useremail>"); 
if (
$success) { 
header ("location:<a href="http://www.somewhere.com/thanks.html" target="_blank">http://www.somewhere.com/thanks.html</a>"); 

else 
header ("location:<a href="http://www.somewhere.com/error.html" target="_blank">http://www.somewhere.com/error.html</a>"); 
}
------------------------------------------------------------------------ 






To display the preview page I send all of the submitted data from page one through a validation function in page two. The data comes out of the validation as a variable and that variable is displayed in the preview message. So is the above code the right way to send that data to my email address??

Surely it's not that complicated to solve,

Thanks for any help.

Reply With Quote
  #2  
Old September 16th, 2004, 03:14 PM
CeCi CeCi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 11 CeCi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 33 sec
Reputation Power: 0
Sometime double quotes within double quotes does not work. I am not sure if it will work, but try this.
if ($success) {
header ("location:<a href='http://www.somewhere.com/thanks.html' target='_blank'>http://www.somewhere.com/thanks.html</a>");
}
else
header ("location:<a href='http://www.somewhere.com/error.html' target='_blank'>http://www.somewhere.com/error.html</a>");
}


Reply With Quote
  #3  
Old September 17th, 2004, 01:52 AM
Slash5 Slash5 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 Slash5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, but that wasn't what my problem is. That part of my script actually works.

My problem is to do with what the user actually types in to my form. If they type: hello "there" my preview page displays it as: hello "there" BUT when this is emailed to me from the form, I only get : hello

Reply With Quote
  #4  
Old September 17th, 2004, 02:38 AM
oyejorge oyejorge is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 oyejorge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 0
This might work... try converting your quotes into coded characters.

PHP Code:
 $_POST str_replace('"''"'$_POST); 

Reply With Quote
  #5  
Old September 17th, 2004, 10:17 AM
Slash5 Slash5 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 Slash5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by oyejorge
This might work... try converting your quotes into coded characters.

PHP Code:
 $_POST str_replace('"''"'$_POST); 



AH HA!

Problem solved. Oyejorge, out of about 15-20 people from different forums that have tried to help me, you're the only one who hit the nail on the head.

Thanks soooooo much.

Reply With Quote
  #6  
Old September 18th, 2004, 02:45 AM
oyejorge oyejorge is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 oyejorge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 0
Thank you Slash, glad I could help.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Can't email anything in double quotes


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway