Hi i need a program that will copy,create a page when the user pushes submit button. It most be able to check directory to see if page exist.
not really enough information there really.. like what must it do if the page exists, how does the person pick which page to copy, or how do they decide if they want to make a new one or copy one? bit vague, explain it more
Your description is very vague, but try this (off the top of my head). <?php if(isset($_POST['submit']) && !empty($_POST['page'])){ //basic security if(ctype_alnum($_POST['page']) == true){ //this is the type of file you want to be created. $ext = ".txt"; $FileName = $_POST['page'].$ext; //check it doesn't exist already if(!file_exists($FileName)){ $FileHandle = fopen($FileName, 'w') or die("can't open file"); fclose($FileHandle); echo "<a href=\"".$FileName."\">".$_POST['page']."</a> has been created sucessfully!"; } else { echo "Page already exists"; } } else { echo "Invalid page name, must be numbers and letters only!"; } } ?> <form action="#" method="post"> Page Name: <input type="text" name="page"><br /> <input type="submit" name="submit" value="Submit"> </form> PHP: