I have an html form where users can submit data. When they submit I am taking that data and writing it to a .txt file. I am having trouble adding quotation marks around my data. I need it to do the following when it writes to the txt file.
$name = $_POST['user'];
$data= "$name"
var Name="$data",
So if he user entered John on the form, I would need it to read: var Name="John",
On my data form. Any help is appreciated. I have tried addslashes, but can't seem to get that to work correctly either.
try this: