Input Problem!

Discussion in 'PHP' started by Gravereaper, Dec 22, 2006.

  1. #1
    I'am using these codes to write a submitted text to a .txt file:
    $datastring = $data . "</BR>" . "__________________________________________________________" . "</BR>";
      $fo = fopen($et,'a');
      if(!$fo)
      {
        die("Cannot open $et"); 
      }
      if(!fwrite($fo,$datastring))
      {
        die("Cannot write to $et"); 
      }
      fclose($fo);
    Code (markup):
    But texts like says, "Hmm, this person looks familiar." gets replaced by something like says, / "Hmm, this person looks familiar." / when written to the text file and it appears the same when read through a PHP file to a .html file.
     
    Gravereaper, Dec 22, 2006 IP
  2. Pierre Monteux

    Pierre Monteux Peon

    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if it is always / then " use str_replace() http://us3.php.net/str_replace to replace all /" with "....what's happening is the escape codes for " are being used for some reason.
     
    Pierre Monteux, Dec 22, 2006 IP
  3. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #3
    instead of:

    echo $contents
    Code (markup):
    try:

    echo stripslashes($contents)
    Code (markup):
     
    daboss, Dec 22, 2006 IP
  4. weknowtheworld

    weknowtheworld Guest

    Messages:
    306
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    where is fwrite () ?
     
    weknowtheworld, Dec 22, 2006 IP
  5. Gravereaper

    Gravereaper Banned

    Messages:
    450
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry, displayed the wrong codes. Edited the topic and fixed the codes.
     
    Gravereaper, Dec 23, 2006 IP