'When I click the submit button that "makes a new character" the page is not coming up. I have tried several things

<?php function Copyit(){
copy('PlaywithTemplate.php','NewCharacter.php');
}
Copyit();
?>


What is your new characters name?
<form action="CopyThis.php"  method="post">
    First Name: <input type="text" name="firstName" /><br>
    <input type="submit" name="submit" value="Submit me!" />
</form>



<?php

if ($_POST){
        
        $filename = $_POST['firstName'];
    
    Rename("C:\Users\Karla\Desktop\Massive Page\NewCharacter.php", "$filename.php");}
    
    echo "C:\Users\Karla\Desktop\Massive Page\'$filename.php";

?>
<br>
<br>

Press this Button to get a new character:<br>
<form action="<?php echo "C:\Users\Karla\Desktop\Massive Page\'$filename.php";?>" target = "_blank"  method="post">
<input type="submit" name="submit">
</form>

This is my code...the Copyit function works and the correct file is pulled up and created when you inspect the code on the web page. I just need to get it to open the file in a new page. I am really a newbie, no formal classes, just poking around, so any help would be appreciated! :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source