Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] PHP Write to TXT File…

  • This topic is empty.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #30236
    coffeendonut
    Member

    Hi to all i need help on code … ok to explain myself wat im trying to do is to have a simple form like this


    Country:
    city:

    and when i type in the information it will post to the welcome.php but wat i also want is to save the posted information to a data.txt file how can i do these… ?

    #79540
    coffeendonut
    Member

    @TT_Mark yeah… i did but all the ones i found uses “fopen” and thats disabled due to Security risks…

    #79549
    coffeendonut
    Member

    @TT_Mark i ask them and they told me that no cause it was disabled due to Security risks… that i should try something similar to it… it didn’t make sense to me thats why im asking here is there a way to do these without using “fopen”… this is the message i get when trying to use “fopen”

    Warning: fopen(data.txt) [function.fopen]: failed to open stream: Permission denied in /home/a4856106/public_html/form.php on line 7
    #79554
    coffeendonut
    Member

    @betzster no… but i think maybe something else… like other type of code… saving the info to TXT or PHP page … when you submit the info…

    #79556
    Rob MacKay
    Participant

    you could probably save it as a PDF…

    http://php.net/manual/en/book.pdf.php

    that won’t write it in to a specific text file but it will create a PDF with the data in it.

    #79566
    coffeendonut
    Member

    @Robskiwarrior yeah i guess… so how would that work… any start on how to set it up…?

    #79436
    Rob MacKay
    Participant

    http://www.devshed.com/c/a/PHP/PDF-Generation-With-PHP/1/ is something useful to read – it is something I have to do on a project at some point soon, but I have not got that far yet to advise :)

    #79374
    coffeendonut
    Member

    @Robskiwarrior yeah anyway thanks… i need to solve this problems thats the only way i will learn how to…

    #79272
    ImpInaBox
    Member

    Are you sure it’s a general ban on fopen() and not just because you’re trying to write somewhere you don’t have permission to?

    #79273
    coffeendonut
    Member

    im doing this in the public html folder…

    #79247
    ImpInaBox
    Member

    You certainly can write to that when you’re logged in via FTP but sometimes not from PHP scripts which run at a very low privilege level (unless you have PHP SuExec installed on your server). You might be able to write into some specific directories – if not I’d change hosts!

    #79248
    eXo
    Member

    why not store it in a database?

    #79275
    coffeendonut
    Member

    @ImpInaBox yeah change host seems to be the option…

    #79240
    coffeendonut
    Member

    @eXo database not my option with this small temporal code…

Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘CSS’ is closed to new topics and replies.