jeudi 8 mars 2018

Creating a new HTML page based on template using a script

I'm trying to make an announcement maker. The way I wanted to do it was to have a basic form, like so:

<form method="post" action="assets/php/contact-form-handler.php" name="contactform">
  <div class="field half first">
          <label for="name">Title</label>
                <input type="text" name="title" id="title" placeholder="Big Game Tomorrow" />
        </div>
        <div class="field half">
          <label for="name">Author</label>
                <input type="text" name="name" id="name" placeholder="John Smith" />
        </div>
        <div class="field">
  <label for="message">Message</label>
        <textarea name="message" id="message" rows="4"  placeholder="Type message here..."></textarea>
        </div>
        <ul class="actions">
          <li><input type="submit" value="Send Message" class="special" /></li>
          <li><input type="reset" value="Reset" /></li>
        </ul>
</form>

And have each input be plugged into an element on a new page. For example Title would be <h1>Title</h1>. Is there a way to do this? I've seen using PHP's fopen but I can't figure out how to plug everything into the page and have the filename change for each post.

Aucun commentaire:

Enregistrer un commentaire