Why extra slashes???
| From: | Wiberg | Date: | Thu, 30 Dec 2004 23:44:28 +0000 |
| Subject: | Why extra slashes??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-205393@lists.php.net to get a copy of this message | ||
Hi there!
Right now I'm creating a form that saves the text from a textarea to an
array. That doesn't seem to be any problem.
But when I save the contents, I get extra / ?
The code looks like this:
-------------------------
//Which main product category is to treat?
//
if (isset($_REQUEST["reqIDKategori"])) {
$streqIDKategori = $_REQUEST["reqIDKategori"];
}
//Save current main category to file
//
if (isset($_REQUEST["saveCategory"])) {
//Open file for writing
//
$handle = fopen("../maincategorypages/" . $streqIDKategori .
".html","wb");
//Get contents of textarea
//
$textArea = $_REQUEST["frmSaveArea"];
//Save all info in textarea into file
//
fwrite($handle, $textArea);
//Close file
//
fclose($handle);
}
//Read maincategory html-file
//
function readFileCategory($ID) {
//Load file into array
//
$returnfile = file("../maincategorypages/" . $ID . ".html");
//Send back array with fileinfo
//
return $returnfile;
}
//Show specific array to screen
//
function showArray($array) {
for ($i=0;$i<count($array);$i++) {
echo $array[$i];
}
}
?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000"
background="../bkg/mainfyll.jpg"
link="#000000" vlink="#000000" alink="#000000">
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="2"
cellpadding="2"><tr><td>
<form
action="maincategory.php?saveCategory=yes&reqIDKategori=<?=$streqIDKategori?
>" method="post" name="frmSaveCatPage">
<textarea cols="50" rows="25"
name="frmSaveArea"><?=showArray(readFileCategory($streqIDKategori))?></texta
rea>
<input type="submit" value="Spara html för huvudkategori">
</form>
</td></tr>
</table>
</td>
<!--Visa annonser i högerspalt-->
<?require("advertise.php");?>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
/G
@varupiraten.se
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.6 - Release Date: 2004-12-28