I want create a form to edit the style and html content of a template web page.
Form Page has:
- An input to enter a h1 heading for the page
- A dropdown box to choose a font for the h1
- A dropdown box to select text size
- An input to enter a subtitle
- Controls to change formatting
- etc
This generates Page B, which is mostly formatted already with css, but uses the inputs from the form to edit some styles, like fonts and colours.
I could do this easily if I just posted the the form to Page B, and inlined the css with something like this:
<h1 style="font-size: <?php echo $_POST['h1-font-size'] ?>pt">
<?php echo $_POST['h1-title']?>
</h1>
But I would prefer to keep the formatting separate from the HTML as these pages may need to be edited by hand in the future. I also want to save the resultant html page and css file for future use.
What is the best and easiest way to do this? I could paste the whole css file into PageB and make page B write it to the server with the specified changes, but this doesn't seem like a very elegant way of doing things.
Background: comp-sci degree, not much web experience.