Question by Briterican: How do I create new html webpages through a php script?
On my website, A user enters information for a product, and that information is sent to my database. I want to also create a page for that product that other people can then view. I’m assuming creation of the file would happen in the PHP script before sending the information, so that the link to the page can also be sent to the server.
Best answer:
Answer by Jim J
// generate a unique $ product_id
$ file_name = “$ product_id.html”;
$ f = fopen($ file_name, ‘w’);
fputs($ f, “My awesome product!“);
fclose($ f);
// send $ file_name to database
What do you think? Answer below!