Another option is to use heredoc syntax for the file content. Note that, as written, you've got quite a serious code injection problem. It can be tricky to sanitize the input properly, which is why generating PHP containing user input is a bad idea. One alternative is to generate an INI file, which you can later load with parse_ini_file.
PHP Code:
<?php
$myFile = "../iniprofiles/pahhh.ini";
$fh = fopen($myFile, 'w');
if (! $fh) {
/* don't use "die" if outputting HTML */
...
} else {
/* Sanitize input */
if (get_magic_quotes_gpc()) {
foreach ($_REQUEST as $key => $val) {
$_REQUEST[$key] = stripslashes($val);
}
}
/* 'strip_tags' may or may not be appropriate, depending on where the data
* will end up. For example, some HTML be allowed in the description.
*/
$data = str_replace("\n", ' ', array_map('strip_tags', $_REQUEST));
$data['title'] = str_replace( " ", "", $data["title"]);
# 'array_filter' will remove empty values
$data['tags'] = implode(',', array_filter(array_intersect_key(
array('tags'=>1, 'tags2'=>1, 'tags3'=>1),
$data)));
$stringData =<<<EOF
title={$data["title"]}
description={$data["info"]}
image={$data["screenshot"]}
name={$data["title"]}
howtostop={$data["stop"]}
tags={$data["tags"]}
producer={$data["producer"]}
EOF;
fwrite($fh, $stringData);
fclose($fh);
}
If for some reason you insist on generating a PHP script, look into applying addslashes if magic quotes are off, but it's still dangerous to mix host and embedded languages when generating output.