I have a a script that write a form input to .sng file (which
using htaccess that I have setup on the server is excatly the
same as a php file) Also when putting a word like don't in it adds a slash in front of the apostrophe.
So hence if you save the data as:
Line 1 text you're here
Line 2 text here
When the browser reads it it doesn't see a <br> command and so prints the above as:
Line 1 text you\'re hereLine 2 text here (note this forum must be using the technology I need as it won't display the slash i purposely put in front of the ' above and it inserts line breaks in the correct place.
My two question are: How do you get the script to insert <br> tags where they are needed, and make sure it doesn't save the slashs at the same time.
If someone could put it in the script I have below I would be most greatful!
<?
if (get_magic_quotes_gpc()."" == "1") {
foreach($_GET as $k=>$v) $_GET["$k"]=stripslashes($v);
foreach($_POST as $k=>$v) $_POST["$k"]=stripslashes($v);
foreach($_COOKIE as $k=>$v) $_COOKIE["$k"]=stripslashes($v);
}
// Strips all extra quotes
?>
$filename = ("l-".$song.".sng"); //sets the filename
}
if(file_exists($filename)) //if it is already there
{
echo ("The lyrics you submitted already exist");
}
else
{
The data is input by the top half of the main script (above is jsut hte bottom half) which is a form that will keep apearing unless the two required fields are filled in. When filled in it sets the filename and writes the contents of the form into certain sections. I.e there is a form input called lyrics, and it add that as data to the file using: $data .= "Lyrics: ".$lyrics."\n";
The script basically takes a form input and saves it with a few extra values stored in a config file to the same directory with an extension of .sng which using .htaccess I have set-up to be the same as a .php extension on the server.
Bookmarks