php: difference between to isset methods? -
Not sure how to name the postal title
I have a submission on my page The button is creating a folder for me as soon as I press it the site automatically refreshes. There is no script set in my document that says that the page should be refreshed. It only happens when I submit anything, right?
if (isset ($ _ POST ['createDir'])) {$ dir = $ _POST ['dirname']; $ Targetfilename = PATH '/' $ Dir; If (! Is_dir ($ targetfilename)) {mkdir ($ targetfilename); Chmod ($ targetfilename, 0777); } Else {echo "folder exists!"; }}
A little more down in my script is the only thing to delete files and folders.
if (isset ($ _ POST ['deleteBtn'])) {Chmod (path, 0777); Foreign currency ($ _POST ['deleted mills'] as $ value) {unlink (path. '/'. $ Value); } Echo "& lt; Meta HTTP-EQUIV = fresh CONTENT = '0'>"; // does not work without it! }
If I click on the submit button to delete a folder, the page does not refresh even if the script works and files are deleted. Where the script is the difference between creating a folder and the other one to delete the file. I really do not really get it.
OK, after our extended conversations in comments, I think That I can now safely say that this is going wrong. The idea is that your code is executed:
- If the Create-Folder button was pressed, then create the folder
- Run through the directory and all the file paths have a variable Store
- If the deleted folder / file button was pressed, remove the folder / file
- Display the directory contents obtained in step 2.
In that case, the error is that the steps above 2 and 3 should be switched ! If you list all the files for the first time, and then delete something, then it will not be visible in that output, because that list was received before it was removed. Generally, you must first delete / modify files / directories to create any user command, and only need the up-to-date status of the file system in the list of the last time
Comments
Post a Comment