Passing a file name with inout tag to php function

I used to know how to do this, then I had a stroke. Need help. I want to specify a file name to create/open in html then pass it to a php routine. How do I do this? Here is what I have:


<?php
if (isset($_POST['logbtn']))
{
	$data = $_POST['logname'];
	$file = $mylog;
	$fh = fopen($file, "w") or die("Couldn't open $file for login!");
	
/* write other data here */
	
	fclose($fh);
}
?>
</head>

<body>

  <form id="setupForm" name="setupForm" method="post" action="">

    
      <p><font size = "5">
        <label><strong>What do you wish to call this file?  </strong></label>
    <input name="mylog" type="text" value="mylog" size="15" maxlength="15">
  </font></p>

  </form>

</body>
</html>

if $data is supposed to be the name of the file, then do

$data = // actual data
/$fname = $_POST[‘logname’];
$fh = fopen($fname, “w”) or die(“Couldn’t open $file for login!”);

Sponsor our Newsletter | Privacy Policy | Terms of Service