Php upload form userinput = filename
<p>Ok building a php webform need one of the entries to be the filename written.</p>

<p>How can I achieve this?</p>

<p>Here's my php code... </p>

<pre><code>$filename = "output.txt"; #Must CHMOD to 666
$text = $_POST['bin'];
$text2 = $_POST['pcn'];
$text3 = $_POST['gnum'];
$text4 = $_POST['memid'];
$text5 = $_POST['urlen'];
$text6 = $_POST['urles'];
$text7 = $_POST['tlogo'];

 # Form must use POST. if it uses GET, use the line below:
#$text = $_GET['theformfieldname']; #POST is the preferred method

$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, "$text\r\n");
fwrite ($fp, "$text2\r\n");
fwrite ($fp, "$text3\r\n");
fwrite ($fp, "$text4\r\n");
fwrite ($fp, "$text5\r\n");
fwrite ($fp, "$text6\r\n");
fwrite ($fp, "$text7\r\n");
fclose ($fp);

header("Location: logo.html"); 
}
else {
echo ("There was an error please submit your request again");
}

?&gt;
</code></pre>

<p>ok need $filename = "output.txt";
to be from the input $text3 = $_POST['gnum']; </p>

<p>something along the lines of:</p>

<p>$filename = $_POST['gnum'].txt; 
but this wont work..</p>

<p>Thanks in advance,
Joe</p>
