Advertisement
mattrix

Untitled

May 10th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['create'])) {
  3.     //$template = file_get_contents('template.html');
  4.     $template = 'Hi {{name}}<br/>Today you spoke with {{contact}}';
  5.     foreach ($_POST as $key => $value) {
  6.         $template = str_replace('{{'.$key.'}}', $value, $template);
  7.     }
  8.  
  9.     //Do something with template
  10.     echo($template);
  11.     echo('<hr /><a href="">New Template</a>');
  12.     die();
  13. }
  14. ?>
  15.  
  16. <html>
  17. <head></head>
  18.  
  19. <body>
  20.     <form action="" method="POST">
  21.         Client: <input type="text" name="name" />
  22.         Spoke To: <input type="text" name="contact" />
  23.         <input type="submit" name="create" value="Create Template"/>
  24.     </form>
  25. </body>
  26.  
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement