Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Ampersands

Status
Not open for further replies.

keen01

MIS
Nov 16, 2004
73
US
I've made a Flash ecard for users to input their text, send it out another user opens it and all is well, unless someone uses an ampersand. I realize it breaks dynamic text. How do I get around that. The link for the page is The PHP code for the POST is
Code:
<?
$CreateEcard = date(U);
$filename = $CreateEcard.".txt";
$ToName = str_replace("&", "&amp", $ToName);
$ToEmail = $_POST["ToEmail"];
$FromEmail = $_POST["FromEmail"];
$ToName = $_POST["ToName"];
$FromName = $_POST["FromName"];
$Greeting = $_POST["Greeting"];
$IntroMessage = $_POST["IntroMessage"];
$EndMessage = $_POST["EndMessage"];
$EcardSelect = $_POST["EcardSelect"];
$ToName = stripslashes($ToName);
$FromName = stripslashes($FromName);
$Greeting = stripslashes($Greeting);
$IntroMessage = stripslashes($IntroMessage);
$EndMessage = stripslashes($EndMessage);
$Today = (date ("l dS of F Y ( h:i:s A )",time()));
$Created="Ecard Created on $Today";
$EcardNum = $EcardSelect;
$EcardText = "ToName=$ToName&ToEmail=$ToEmail&FromName=$FromName&FromEmail=$FromEmail&Greeting=$Greeting&IntroMessage=$IntroMessage&Created=$Created";

$fp = fopen("dBText/$filename","w");
fwrite($fp, $EcardText, 10000);
fclose( $fp );

It's usually in the ToName everyone wants to put Jane & John. I tried adding $ToName = str_replace("&", "%26", $ToName); but that didn't work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top