I'm writing a simple rename
form that renames the folder name. It works fine, but if the file doesn't exist PHP gives me an error.
<form>
<input type="text" value="folder name you want to rename">
<input type="submit">
</form>
And this is my PHP code:
<?php
session_start();
$_SESSION['name'] = $_POST['name'];
rename("../folders/".$_POST['name']."","../renamed/new-name");
?>
The code works perfectly, but I want to add an if/else statement because when I run the script for a folder that does not exist, I get this error.
Does not exist
I want to remove the error, and simply output "doesn't exist".