problems writing to a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

problems writing to a file

Post by psychotomus »

Code: Select all

<center>
<a href="main.php?id=profile">Profile</a>
     <a href="main.php?id=newsletter">Newsletter</a>
     <a href="main.php?id=portfolio">Portfolio</a>
     <a href="main.php?id=employment">Employment</a> 
     <a href="main.php?id=contact">Contact</a>
</center>
thats what i write to a file threw a form

this is the outcome

Code: Select all

<center>
<a href="main.php?id=profile">Profile</a>
     <a href="main.php?id=newsletter">Newsletter</a>
     <a href="main.php?id=portfolio">Portfolio</a>
     <a href="main.php?id=employment">Employment</a> 
     <a href="main.php?id=contact">Contact</a>
</center>
this is how i write the file

Code: Select all

$pw=$_POST&#1111;'pw'];
$id=$_POST&#1111;'id'];
$info=$_POST&#1111;'info'];

$fp = fopen('files/'.$id, "w");
fwrite($fp, $info);
fclose($fp);
how i can i get it to write to the file without adding \
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

magic quotes - devil's spawn - switch em off
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

how i switch them off?
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Change the option on your php.ini. Locate these lines

• magic_quotes_runtime = On
• magic_quotes_sybase = On

and change them to Off. Take the time to read this: http://www.php.net/configuration before changing these options.

Cheers,
Scorphus.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you can't adjust your php.ini: stripslashes()
Mac
Post Reply