SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Newbie Questions

    I've been posting newbie as I am not only knew at this forum. Here's my question: After typing several text files using forms, how can I save it as an HTML file?
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  2. #2
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand you, but you can just rename .txt files into .html, and it will work.

    Carl
    Ohai!

  3. #3
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry if I didn't elaborate what I was trying to say.

    Normally, people would make use of PHP then integrate it with mySQL to build a database system. I'm only limited to 5 MB of Database storaage so what I need is instead of putting it in the Database, I'll try to save it as an HTML file, or PHP file perhaps.

    Still don't get it? Example, one of my admin login using their username and password, of course. Then they choose one section, for instance, business reports. After clicking it, they will see a formmail typing all the data needed for the said report. When they click submit or save, instead of it being saving in the database, I would like it to be save as a PHP files instead with a *.php section.

    How do I do that?
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  4. #4
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, this is just a simple basic example
    PHP Code:
    <?php
     
    if ($submit == 'send') {
      
       if (
    $fp fopen('path/textfile','w')) {
           
    fwrite($fp,$username);
           
    fclose($fp);
           echo 
    'data saved';
       } else
           echo 
    'file error';
      exit();
     }
    ?>
    <html>
    <body>
     
    <form action="<?=$PHP_SELF?>">
      <input type="text" name="username">
      <input type="submit" name="submit" value="send">
    </form>

    </body>
    </html>


Bookmarks

Posting Permissions

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