[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: backslash apostrophe in php



It sounds like magic_quotes is turned on in your php config (php.ini).  You can either trun this off or run $msg through stripslashes().  For example:
$fullmsg="Hello $Row[name]: \r\n\n".stripslashes($msg);)
 
Their may be a better way of doing this, but this should work.
 

Justin R. Meats
(217) 221-0664
justin@internetpartners.com
http://www.internetpartners.com

-----Original Message-----
From: luci-discuss-owner@luci.org [mailto:luci-discuss-owner@luci.org]On Behalf Of Ricky Bryce
Sent: Thursday, October 03, 2002 7:04 AM
To: luci-discuss@luci.org
Subject: backslash apostrophe in php

My students are in MySQL database on a mailing list containing their name and email address. I have a page set up on the intranet that I can go to in order to enter a text message. When I hit submit, the msg variable is carried over to a page containing PHP code which takes each student from MySQL, and sends them an email.

The only problem I am having right now is that if I enter an 's on the textbox of the form, my code is sending out a \'s. For example: The word dont't get sent to the student as don\'t.

It looks like one part of my code might be anticipating that an escape must be sent before the ', but in reality it doesn't need to be sent. I figured others probably have had similar problems. Please let me know if you have any ideas! My code is pasted below. The form code is at the top, and then the php code which pulls the data from the database is on the bottom. This php code is inside of a loop.


Form Code:
<form name="form" method="post" action="dbrun.php">
<p><center><textarea COLS="100" ROWS="40" WRAP="soft" name="msg"></textarea></center><p>
<center><input type="Submit" name="Submit" value="Submit"></center>
</form>



dbrun.php code:
$to="$Row[email]";
$subject="PLC Training";
$fullmsg="Hello $Row[name]: \r\n\n$msg";
mail($to,$subject,$fullmsg,'From: Instructor <me@mydomain>');


Thanks!

Ricky