How to generate a .html on the filesystem

Discussion in 'PHP' started by arvishreef99, Jun 17, 2009.

  1. #1
    Hello Guys,

    I have a page x.php retrieving data from a table. The page x.php will display several users.

    Then i have a second page generate.php that will generate a .html on the filesystem when i clicked on a button .
    For example when i select user man and clicked generate.
    It will generate a page man.html in the filesystem.


    If anyone have any ideas, let me know.


    Thanks in advance,
    Arvish
     
    arvishreef99, Jun 17, 2009 IP
  2. techbongo

    techbongo Active Member

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #2
    The link on x.php page should be like this: generate.php?user=username_or_userID

    Code for generate.php may be different. A sample is here:

    <?php
    $fp = fopen($_REQUEST['user'].'html', 'w');
    fwrite($fp, '<html><head>Head Code Of HTML</head><body>String Body Code Of HTML or User content');
    fwrite($fp, 'User Content 2 or any string</body></html>');
    fclose($fp);
    ?>
     
    techbongo, Jun 17, 2009 IP