Hey, I am currently programming a small script for my website which submits form information into a brand new page, into a directory created in the users name; if it doesn’t exist, it will create it. The information entered is supposed to travel to a “thank you” message which would also display a link to the created page. I have done something like this before, but it’s been a few years and my coding is a bit rusty. I had thought this bit of coding would work, but I receive an error upon submission. Any help is highly appreciated. Thanks.
Here is my form code:
[code]
Name:
Title:
Words:
submit.php
[php] <?
if (isset($_POST[‘submit’])) {
$ttle = $_POST[‘title’];
$pstr = $_POST[‘name’];
$wrds = $_POST[‘words’];
// Store in or create directory
if(!file_exists($pstr))
{
mkdir($pstr);
}
// Create file
$fileName = dirname(FILE)."/$pstr/$ttle.html";
$fh = fopen($fileName, ‘w’) or die(“can’t open file”);
$str = "
the words:
$wrds ";
fwrite($fh, $str);
fclose($fh);
// End create file
echo “Congradualations!
The file has been created.
Go to it by clicking <a href=”$pstr/$ttle.html">here.";
die();
}
?>[/php]