Search code examples
php4

PHP write file... need help


<?php
$title = $_POST['title'];
$filename = $title , ".php";
$fh = fopen($filename, 'w') or die ("can't open file");
$stringData = $title;
fwrite($fh, $stringData);
$stringData = $blog;
fwrite($fh, $stringData);
fclose($fh);
?>

This is only a sample. What is the correct code for that?


Solution

  • You are using the correct code there, what is the point?

    Also note that you are using a comma rather than a dot to concatenate strings at:

    $filename = $title , ".php";