Alright, I managed to get it working how I want (although some/most might disagree with the method). I used Flask as recommended below. The part that might be considered \"w
What you want is possible, but it's really about 3 problems.
The first question is, how do you create a new file from PHP. I can't really answer this one. What you need to do, probably depends on what kind of file you're trying to create and why.
The second question is, how do you let the user know this is happening, and the third is how do you redirect to the new page.
Personally, I think the shortest route to victory, is probably to have your client-side javascript make an AJAX request to the server page or CGI module that creates your new content.
As someone new to web development, the easiest thing to do might be to look into jQuery and it's AJAX functionality. The wrappers there make it pretty easy to do the above. Of course you can do the same with any of the other major javascript frameworks or straight javascript as well.
For reference: