Advertisement
mattrix

Untitled

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