HELP needed with if statement
Posted: Thu Apr 05, 2012 12:37 am
Does anybody have any idea why the following code does not execute correctly. I want the fields in the form to be checked for content on submission but the if condition is just passed even when there isn't any content held in the fields. I'm confused:
any help will be much appreciated...thanks
Code: Select all
<?php
include 'initialize.php';
if (!(isset($_SESSION['user_id'])&& $_SESSION['user_id']!=''))//if the following is false- session not been assigned a valid user value/is blank then...
{
header('Location:index.php');
end();
}
include 'template/top.php';
?>
<h3>Create Folder</h3>
<?php
if (isset($_POST['folder_name'], $_POST['folder _description']))
{
$folder_name = $_POST['folder_name'];
$folder_description = $_POST['folder_description'];
if (empty($folder_name) || empty($folder_description))
{
echo 'Folder name and description required';
}
else
{
create_folder($folder_name, $folder_description);
header('Location: uploads.php');
exit();
}
}
?>
<form action='' method='POST'>
<p>Name:<br/><input type='text' name'folder_name' maxlength'55'/></p>
<p>Description:<br/><textarea name='folder_description' rows='6' cols='35' maxlength'255'></textarea></p>
<p><input type='submit' value='Create' /></p>
<?php
include 'template/bottom.php';
?>