• PHP/HTML - Create/Rename Directory Scripts Are Near Identical; First Works, Second Doesn't
    2 replies, posted
[editline]11:19PM[/editline] Sorry, I just realized that this is the wrong forum. I'll go post this in Web Dev, ignore this idiot post. Hey folks, I've been battling with this for hours and I can't for the life of me understand why this isn't working. I have a site that you can create and upload your own folder on to, and then rename it. The more intricate stuff works; what doesn't work is simple and makes no sense as to why it doesn't work. First, the form to create a directory: [code]<p class='registertext'>You don't have a folder yet!</p><br /> <form name='create_folder' method='post' action='upload.php?action=createfolder'> <input type='text' name='foldername' width='300px' maxlength='36'> <input type='submit' value='Create Folder'> </form>[/code] Then the form to rename the directory: [code]<p class='registertext'>Rename Folder</p><br /> <form name='rename_folder' method='post' action='rename.php?action=renamefolder'> <input type='text name='foldername' width='300px' maxlength='36'> <input type='submit' value='Rename Folder'> </form>[/code] Near identical. Now, for the second part, like I said, all the intricate MySQL stuff works to the best of my knowledge, but the $_REQUEST gets funked up. I have a basic strlen() test to make sure that the user actually enters something for the name. With the create directory, it goes fine: [code] if($_POST['action'] == "createfolder") { $username=$_SESSION['loginname']; $foldername=$_REQUEST['foldername']; if (strlen($foldername)==0) { header("Location: manage.php?createfolder=failed&cause=".urlencode('Please enter a folder name!')); } else { .. the else } [/code] But my second code, which is practically IDENTICAL, for some reason manages to not pick up the second form's foldername. Instead, it returns true for $foldername having a length of 0, and shoots me back to manage.php with my error message. I have no idea why this would happen. [code] if($_GET['action'] == "renamefolder") { $username=$_SESSION['loginname']; $foldername=$_REQUEST['foldername']; if (strlen($foldername)==0) { header("Location: manage.php?renamefolder=failed&cause=".urlencode('BROKEN AS HELL')); } else { ... the else } [/code] I've tried all sorts of things such as giving the forms individual variables, referring to the variables in different ways, but I can't figure out what gives. Does anybody have any idea? It'd be MUCH appreciated; I've been working at this for ages.
Web programming. [editline]11:44PM[/editline] DAMN :ninja:
have you tried $_POST["foldername"]
Sorry, you need to Log In to post a reply to this thread.