Jump to content

[SOLVED] fwrite and stripslashes prob


pcw

Recommended Posts

Hi, this code does not work, and if i remove stripslashes, then it writes \\\ into the file.

 

How can I get fwrite and striplslashes to work together?

 

<?php
if($_POST = 'submit') {
$filename = $_POST['filename'];
$temp_code = $_POST['template'];
$fa = fopen( $filename, "w" ) or die("Error opening $filename");
fwrite(stripslashes( $fa, $temp_code ));
fclose( $fa );
}
?>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/149237-solved-fwrite-and-stripslashes-prob/
Share on other sites

if($_POST['submit']) {
 $filename = $_POST['filename'];
 $temp_code = stripslashes($_POST['template']);
 $fa = fopen( $filename, "w" ) or die("Error opening $filename");
 fwrite($fa, $temp_code);
 fclose( $fa );
}

 

Also look at this line

if($_POST = 'submit') {

 

Change to

if($_POST['submit']) {

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.