how to create a html page programatically using PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijcbe
    New Member
    • Sep 2007
    • 16

    how to create a html page programatically using PHP

    Hello friends,
    I wish to create a new HTML page, using a PHP coding. The name of the HTML page should be of user's wish. Someone please help me doing it.

    Thanks a million,
    VJ
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, VJ.

    Assuming you are using a form to create the page, you'd simply:

    [code=html]
    <title><?php echo $_POST['title']; ?></title>
    [/code]

    Comment

    • post
      New Member
      • Sep 2007
      • 17

      #3
      Originally posted by vijcbe
      Hello friends,
      I wish to create a new HTML page, using a PHP coding. The name of the HTML page should be of user's wish. Someone please help me doing it.

      Thanks a million,
      VJ
      To create the actual file you could use this by using pagename.php?pa ge_name=somepag e
      [php]
      <?php
      $name = $_GET['page_name'];
      $data = "Some Data";
      $path = $_SERVER['DOCUMENT_ROOT'];
      if (file_exists("$ path/$name.html")) { echo("Already exists!"); $exists = true; }
      if (!empty($data) && !$exists) { file_put_conten ts("$path/$name.html", $data); }
      ?>
      [/php]

      Comment

      Working...