Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['create'])) {
- //$template = file_get_contents('template.txt');
- $template = 'Hi {{name}}\nToday you spoke with {{contact}}';
- foreach ($_POST as $key => $value) {
- $template = str_replace('{{'.$key.'}}', $value, $template);
- }
- $template = str_replace('\n', ' ', $template);
- //Do something with template
- echo('<textarea style="width:100%;height:50%">'.$template.'</textarea>');
- echo('<hr /><a href="">New Template</a>');
- die();
- }
- ?>
- <html>
- <head></head>
- <body>
- <form action="" method="POST">
- Client: <input type="text" name="name" />
- Spoke To: <input type="text" name="contact" />
- <input type="submit" name="create" value="Create Template"/>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement