PDA

View Full Version : Where abouts in this script would i put Stripslashes??


Silver Sun
10-13-2002, 03:01 PM
In the below script, i need to remove the slashes that appear in $name. Could you please tell me where abouts to put the stripslashes() tag, and how to write it.


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" text="#000000">

<table width="100%" border="0">
<tr>
<td>

<?php
$file="test.txt";
$fp=fopen("$file", "a+");

$write=("$name");

fwrite($fp, "$write", );
fclose($fp);
include ("test.txt");

?>

</td>
</tr>
<tr>
<td>
<font color="ffffff" size="1">

<a name="last">last</a>

</font>
</td>
</tr>
</table>
</body>
</html>




Thanks in advance

mordred
10-13-2002, 04:06 PM
$fp = fopen($file, "a+");

$write = stripslashes($name);

fwrite($fp, $write);


BTW, stripslashes() is not a tag, it's a function. That's a fundamental difference that comes from the fact that PHP is a programming language unlike HTML, which (as the name already implies) is a markup language.

So much for pedantic semantics. ;)

Galdo
10-13-2002, 04:10 PM
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" text="#000000">

<table width="100%" border="0">
<tr>
<td>

<?php

stripslashes($name);

$file="test.txt";
$fp=fopen("$file", "a+");

$write=("$name");

fwrite($fp, "$write", );
fclose($fp);
include ("test.txt");

?>

</td>
</tr>
<tr>
<td>
<font color="ffffff" size="1">

<a name="last">last</a>

</font>
</td>
</tr>
</table>
</body>
</html>