All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

fwrite adding unwanted charecters

  • # February 2, 2013 at 2:34 am

    Hi,
    I have this PHP code:

    < ?php
    if (isset($_POST)) {
    $file = fopen(ROOT . ‘pages/’ . $_POST, “wb”);
    if(!$file === false) {
    echo fwrite($file, stripslashes($_POST));
    fclose($file);
    $title = strtolower(str_replace(” “, “_”, $_POST));
    rename(ROOT . ‘pages/’ . $_POST, ROOT . ‘pages/’ . $title . ‘.php’);
    }
    }
    ?>

    And it keep adding newlines and spaces where i don’t what them.
    Please can you help me!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed