I have a user HTML form on my site. On 'submit' of the form, I am using PHP buffering to save the output as an html file in my root directory.
Currently, the file generates and saves successfully, with an assigned page name it gets from one of the form fields. So far, so good.
The following code works brilliantly to achieve that:
<?php
ob_start();
$headline=preg_replace('#[^_0-9a-zA-Z]#', '_', $_REQUEST['banner']);
?>
/* My 'Form Page' Content Here */
<?php
echo '';
file_put_contents($headline . '.html', ob_get_contents());
However....
I would like to include a drop down selector in my form, with different 'sections', such as: "News", "Sports", "Weather", etc.... to choose a specific directory (folder) on my server, so the generated html file will save to an assigned directory.
I need help on the form field side of that, as well as the php buffering side to achieve this. I am not sure where to begin.