Jump to content

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']) {

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.