Announcement

Collapse
No announcement yet.

PHP Creation of New Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Creation of New Page

    I am wondering if there is some code that uses PHP to create a HTML page.


    Thanks,

    TheTopday

  • #2
    That doesn't really make a lot of sense. You can embed HTML in php code like this:

    PHP Code:
    <?php

    echo "<b>This is bold</b>";

    ?>

    What exactly are you trying to do?

    Comment


    • #3
      Sounds like a "Web Page Generator"
      Do you mean like a php script that will automatically create pages when you enter all the data in the PHP page?
      For example:
      PHP Code:
      <?php
      if(!$_POST) {
      print <<<EOF
      <!-- form here -->
      EOF;
      } else {
      # fopen / fwrite code here;
      }
      ?>

      Comment


      • #4
        Originally posted by SNN
        Sounds like a "Web Page Generator"
        Do you mean like a php script that will automatically create pages when you enter all the data in the PHP page?
        Yes, that's what I meant.

        Originally posted by Dilly
        What exactly are you trying to do?
        When a user submits a form, it will create a new page and then enter the form data into it.

        Comment


        • #5
          I could possibly make this, what are you looking for features or are you just looking for something basic/simple?

          I've started development on this script and I will post a final product/download page soon.

          I've completed the script.
          http://209.40.204.63/~sanms/proj/hl.php

          Note: if you're using this for other people to create pages on your website, this can be a major security threat!

          Also, you will need to chmod the directory(ies) that you're using this on to 777.
          Last edited by SNN; Thu 21st Feb '08, 4:56pm.

          Comment


          • #6
            Thanks. I really appreciate it!

            Comment


            • #7
              Uh how about...

              PHP Code:
              <html>
              <body>

              <p>Your form...</p>

              <div id="my_form">
              <form action="thisscript.php" method="post" title="My Form">
              <input type="text" name="your_text_area">
              <input type="submit" value="Submit">
              </form>
              </div>

              <?php

              if ($_POST) {
                  foreach(
              $_POST as $key => $value) {
                      
              $post_vars[$key] = $value;
                  }
                  echo 
              "<pre>";
                  
              print_r($post_vars);
                  echo 
              "</pre>";
              }

              ?>

              </body>
              </html>

              Comment


              • #8
                No problem. If you require any other assistance (see pm for the answers to your questions), just drop me a PM.
                Just in case this question comes up: the script only requires to have the directory CHMOD'd as "777" because it needs to be able to create a file. Otherwise it will return that it cannot write to the file.

                Happy to help,
                Billy

                Comment


                • #9
                  Basically you have to create your content from the posted form, (as given in the example above) and add the required HTML around it. Save everything into a variable and when you are done with content, write it into a file with php file management (fopen, fwrite) functions. There are tons of code sippets available on net. Just make sure that you give permission (777) to the directory in which you are going to write.
                  Hosting Coupons: Hostmonster @ $3.95 and 20% off Mediatemple

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X