-1

I was wondering if you can add a variable to a file-path.

Example:

path: C:\\users\\john\\school\\hardware.properties";

I want to make a variable of the word preceding the . (dot) - in this case, "hardware" - so the user can write a name in a form and search/get another property.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
phpscrub
  • 25
  • 6

2 Answers2

0

You can just make it a string and add the var into it

$name = $_POST['name']

$path = "C:/.../".$name.".properties"
Jasper B
  • 346
  • 3
  • 17
0

I just make more sure what Jasper B want to write:

In your form you have some submit input and text input.

You will get datas from inputs so you will just access them like:

$name = $_POST["name"];

After you just put $name variable to path like:

$path = "C:\users\john\school\".$name.".properties";
Marty1452
  • 430
  • 5
  • 19