Results 1 to 8 of 8

Thread: Write to file?

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Write to file?

    I have a simple form on my page that contains a textarea. I am saving the text in this textarea to a specified file in an input field. The problem is that when the text is saved to the file, it adds '\' before characters like quotes (single and double) and other things. How can I prevent this?
    Last edited by The Hobo; Apr 15th, 2002 at 04:32 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    scoutt
    Guest
    add

    $variable = htmlspecialchars($variable)

    and / or make sure the magic_quotes_gpc is on in php.ini file.

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    With that code, the file contents end up looking like this:

    <pre style=\"background:#F4F4F4;\"><!-- WARNING: This tag is required to maintain spacing! --><font color=\"#008800\">\'Coded by Kristopher Wilson \'http://www.mindlessdrone.com/ \'[email protected] \' \'Create a form with two command buttons and drop \'in the following code to see how to use the FlashWindow \'API </font> <font color=\"#000088\">Private Declare Function </font>FlashWindowEx <font color=\"#000088\">Lib </font>\"user32\" _ (pfwi <font color=\"#000088\">As </font>FLASHWINFO) <font color=\"#000088\">As Boolean </font> <font color=\"#000088\">Private </font>Type FLASHWINFO cbSize <font color=\"#000088\">As Long </font> hwnd <font color=\"#000088\">As Long </font> dwFlags <font color=\"#000088\">As Long </font> uCount <font color=\"#000088\">As Long </font> dwTimeout <font color=\"#000088\">As Long End </font>Type <font color=\"#000088\">Const </font>FLASHW_STOP = 0 <font color=\"#000088\">Const </font>FLASHW_CAPTION = &H1 <font color=\"#000088\">Const </font>FLASHW_TRAY = &H2 <font color=\"#000088\">Const </font>FLASHW_ALL = (FLASHW_CAPTION <font color=\"#000088\">Or </font>FLASHW_TRAY) <font color=\"#000088\">Const </font>FLASHW_TIMER = &H4 <font color=\"#000088\">Const </font>FLASHW_TIMERNOFG = &HC <font color=\"#000088\">Dim </font>flshWindow <font color=\"#000088\">As </font>FLASHWINFO <font color=\"#000088\">Private Sub </font>Command1_Click() <font color=\"#000088\">With </font>flshWindow .cbSize = Len(flshWindow) .dwFlags = FLASHW_ALL <font color=\"#000088\">Or </font>FLASHW_TIMER .dwTimeout = 0 .hwnd = Me.hwnd .uCount = 0 <font color=\"#000088\">End With </font> FlashWindowEx flshWindow <font color=\"#000088\">End Sub </font> <font color=\"#000088\">Private Sub </font>Command2_Click() flshWindow.dwFlags = FLASHW_STOP FlashWindowEx flshWindow <font color=\"#000088\">End Sub </font></pre>
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Is there a way I can just strip the '\' characters out of it?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    scoutt
    Guest
    Originally posted by scoutt
    make sure the magic_quotes_gpc is on in php.ini file.

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Try passing it through the stripslashes() function

  7. #7

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by scoutt
    make sure the magic_quotes_gpc is on in php.ini file.
    If I knew where the php.ini file was, maybe...
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by chrisjk
    Try passing it through the stripslashes() function
    You da man Thanks!
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width