I have this PHP script that is supposed to create an article when you fill out a form. I go the code from various sources combined but it does not seem to work. The code does not report any errors but when I try to go to http://somesite.com/article/article-name
it gives me a 404
Code:
if (isset($_POST['title']) && isset($_POST['content'])) {
if(!file_exists(dirname('/article/' . str_replace(' ', '-', $_POST['title'])))) {
mkdir(dirname('/article/' . str_replace(' ', '-', $_POST['title'])), 0777, true);
touch('/article/' . str_replace(' ', '-', $_POST['title']) . '/index.php');
file_put_contents('/article/' . str_replace(' ', '-', $_POST['title']) . '/index.php', $_POST['content']);
}
}
Any ideas on what is going wrong? All help appreciated!