stripslahes problem in mailer script
Moderator: General Moderators
-
gretchenland.com
- Forum Newbie
- Posts: 4
- Joined: Mon Jan 26, 2004 9:18 am
- Location: USA - Bristol, TN
stripslahes problem in mailer script
I'm relatively new to php and am having trouble with "stripslashes" in a self processing tellafriend mail script I've been working on...
Here's where the form is located>> http://www.gretchenland.com/gforce/tellafriend.htm I'd really appreciate it if someone would take a quick peek at the page and help out with this... The page is an html page with the script innbedded
Here's where the form is located>> http://www.gretchenland.com/gforce/tellafriend.htm I'd really appreciate it if someone would take a quick peek at the page and help out with this... The page is an html page with the script innbedded
Last edited by gretchenland.com on Mon Jan 26, 2004 10:13 am, edited 1 time in total.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
gretchenland.com
- Forum Newbie
- Posts: 4
- Joined: Mon Jan 26, 2004 9:18 am
- Location: USA - Bristol, TN
The text that's sent asa message with this mailer (text that's input the message text box) shows up with slahes in it if the message contains ' or other special characters...
in example
don't shows up as don''t
in example
don't shows up as don''t
Last edited by gretchenland.com on Mon Jan 26, 2004 10:21 am, edited 1 time in total.
-
gretchenland.com
- Forum Newbie
- Posts: 4
- Joined: Mon Jan 26, 2004 9:18 am
- Location: USA - Bristol, TN
I kind a bastardized a few scripts that I found on the net to make this... then when I was testing it -- the slash problem showed up. I then searched for a "cure" and came across "stripslashes" via Google... So far I couldn't find an exampl of it that I could gleen from...Bech100 wrote:can we see your code
are you using the [php_man]stripslashes[/php_man]() function?
I posted a link to the actual page above because I figured that it would be easier to just look at the page -- here's the form by itself with most of the xtra html removed...
Code: Select all
<html>
<head></head>
<body>
<?php
if (!$Submit){ ?>
<form action="<?php echo $PHP_SELF; ?>" method="post" name="tafform" id="tafform">
<TABLE width=400 border=0 cellPadding=5 cellSpacing=0 id="tell-a-friend-form">
<TBODY>
<TR>
<TD align=left class=prompt>Enter Your Name & Email: </TD>
</TR>
<TR>
<TD align=middle class=prompt><TABLE width=329 border=0 align="center" cellpadding="5" cellspacing="0">
<TBODY>
<TR>
<TD width="135"><div align="right"> Name: </div></TD>
<TD width="174"><INPUT name=name class="email_entry_field" size="30" maxLength=50>
</TD>
</TR>
<TR>
<TD><div align="right"> Email Address:</div></TD>
<TD><input name="from_email" type="text" class="email_entry_field" size="30" maxlength="50">
</TD>
</TR>
<TR>
<TD colSpan=2></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD align=left class=prompt><BR>
Enter Your friends' email addresses:<br> <span class="fineprint_NO_BORDER">You
may enter as many as you like-- but seperate them with a ","
</span></TD>
</TR>
<TR align="left">
<TD></TD>
</TR>
<TR>
<TD align=middle><TABLE width=329 border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD align=center class=prompt><textarea name="to_email" cols="60" rows="3" wrap="VIRTUAL" class="email_entry_field"></textarea></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD align=left> <input name="subject" type="hidden" id="subject" value="I want you to check out this band!!!">
Message/Comments: </TD>
</TR>
<TR align="center">
<TD height="115"> <textarea name="message" cols="60" rows="8" wrap="VIRTUAL" class="email_entry_field">I just found Gretchen's website and thought that you would like to check them out!!!</textarea></TD>
</TR>
<TR align="center">
<TD><input type="Submit" name="Submit" value="Send!!! "></TD>
</TR>
</TBODY>
</TABLE>
</form>
<?php
} else {
$headers = "From: $name <$from_email>\r\n";
$headers .= "Bcc: $to_email\r\n";
$line1="This message was sent by $name from Gretchenland.com:";
$line2="Join the Gretchen E-team today & get CD's, shirts, stickers, along with other cool stuff by helping promote Gretchen online!!! For more info go to http://www.gretchenland.com/gforce";
mail("$to","$subject","$line1\n\n\n$message),\n\n$line2\n","$headers");
print "<br><b>Your email has been sent</b><p>";
print "<b>This is what you submitted:</b><p>";
print "<b>Your Name:</b> $name<p>";
print "<b>E-Mail:</b> $from_email<p>";
print "<b>Message/Comments:</b><br>$message<p>";
print "<a href="http://www.gretchenland.com/gforce/tellafriend.htm"> «« go back</a></font>";
} ?>
</body>
</html>Code: Select all
$message = "stripslashes($message)";Code: Select all
$headers = "From: $name <$from_email>\r\n";
$headers .= "Bcc: $to_email\r\n";- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You mustn't put function calls into quotes:
literally prints out:
you get:
Code: Select all
<?php
$message = 'test "this is a test"';
$message = "stripslashes($message)";
echo $message;
?>if, however, you do:stripslashes(test \"this is a test\")
Code: Select all
<?php
$message = 'test "this is a test"';
$message = stripslashes($message);
echo $message;
?>Mactest "this is a test"
-
gretchenland.com
- Forum Newbie
- Posts: 4
- Joined: Mon Jan 26, 2004 9:18 am
- Location: USA - Bristol, TN