knight47 Posted February 6, 2007 Share Posted February 6, 2007 I have no idea why this is giving the die() error, everything seems to be fine, can anyone spot any errors: <?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.site.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.site/cards/" . $file . ">www.site.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 Link to comment https://forums.phpfreaks.com/topic/37245-creating-a-file-with-php-getting-an-error/ Share on other sites More sharing options...
Jessica Posted February 6, 2007 Share Posted February 6, 2007 You never define $file. Link to comment https://forums.phpfreaks.com/topic/37245-creating-a-file-with-php-getting-an-error/#findComment-177900 Share on other sites More sharing options...
knight47 Posted February 6, 2007 Author Share Posted February 6, 2007 You never define $file. jesirose... if I could pay a penny every time you helped me, you would be rich! thank you so much! Link to comment https://forums.phpfreaks.com/topic/37245-creating-a-file-with-php-getting-an-error/#findComment-177903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.