How to name a new folder with a variable?

I want to use a form to name a new folder and create it.

I have a php script that successfully creates a new folder named “folder_name”

I have an html script that generates a form output.

When I put the form output variable, $_POST[‘project’] , into the folder_name, the php script breaks.

if(mkdir($thisdir . “/folder_name/”, 0777,true))

becomes

if(mkdir($thisdir . “/$_POST[‘project’]/”, 0777,true))

= fatal error.

The following script generates a folder and has a form not connected to eachother.

<?php //the form generates a string within the $_POST variable aka $_POST['project'], which must be substituted in place of the file name aka upload. $thisdir = getcwd(); //The getcwd() copies an absolute pathname of the current working directory to the array if(mkdir($thisdir . "/folder_name/", 0777,true)) // creates a subfolder called "upload" and a new file called "145" {echo "Directory has been created successfully..."; }else {echo "Failed to create directory..."; } ?> " method = "POST"> Name: Age: New Project:

This post was flagged by the community and is temporarily hidden.

Thankyou!!! It works!!!