creating a file with php - getting an error

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

knight_47

Thread Starter
Joined
Mar 14, 2006
Messages
941
I have no idea why this is giving the die() error, everything seems to be fine, can anyone spot any errors:

PHP:
<?php

$name = htmlspecialchars($_POST['name']);
$msg = htmlspecialchars($_POST['msg']);
$clean_name = stripslashes($name);
$clean_msg = stripslashes($msg);
$cleaner_name = rtrim($clean_name);


$card = '<HTML CODE IS HERE>';

$link = "$cleaner_name" . ".htm";

if ($_POST['Submit'] && !empty($cleaner_name) && !file_exists($link))
{
  $create = fopen($file, 'w') or die("Hm... There seems to be an error!");
    fwrite($create, $card);
    fclose($create);
	echo '<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.knight47.com/cards/' . $link  . '">';
}
else 
{
echo "Sorry, there seems to be a few problems, either 1, you left the Name field empty, if so, click back in your browser button, or that $cleaner_name has already been submitted, please visit <a href=\"http://www.knight47.com/cards/" . $file . ">www.knight47.com/cards/" . $file . "</a> to view the already existing card, thanks!";
}
?>
I keep getting this: "Hm... There seems to be an error!", which is supposed to be the error message if something goes wrong, but I have no idea what is wrong.

The folder is chmod to 777, and the php file is chmod to 755.

Thanks
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top