added new functionality to add.php