Reputation: 111
I work on a PHP-app with some live functions etc. I have created a PHP script that does the following:
Then my problem is - I need script to create two files with a specific content - but the variable called from the form input must be included so it calls from the specific (here) JOHN-table in the database.
I tried just to copy - but it requires to manually edit the file. As there'll be unlimited tables created, I don't want to do this. :)
I then tried to make the script create a new file. Worked - except it can't include PHP-variables or tags - which makes sense, of course, but I am stuck now. :(
Can anyone help?
Upvotes: 0
Views: 408
Reputation: 16462
Nanne's answer is the way to go. But if you really curious about this, of course you can write the code to edit the script.
Replace all variables with str_replace
. Maybe something like this:
$contents = str_replace('$name = "NAME"', '$name = "John"', $contents)
Save the contents back to the file.
Upvotes: 1
Reputation: 64419
Upvotes: 1