I am using this form:
<form class="sfmform" action="" method="post">
    <input type="text" name="dirname"  />
    <input type="submit" class="Button Primary" name="mkdir" value="Makedir" />
</form>
This is how php handles the form:
<?php
    if ($_POST['mkdir']) {
        $DirectoryName = $_POST['dirname'];
        mkdir($dir . '/' . $DirectoryName, 0777, true);
    }
?>
Now i want to protect the form: only characters a-z, A-Z and 0-9 are allowed to input. How can i protect this with php
 
     
     
     
    