Monday, 1 February 2016

How to make HTML File using PHP

If you are familiar with C filing programming then your knowledge will be work here. Just copy and paste the following complete code and implement your logic as you want 

$myfile = fopen($_POST['fnm'].".html", "w") or die("Unable to open file!");
fwrite($myfile, $_POST['msg']);

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Girfa : How to make HTML File using PHP</title>


<form method="post"  action=<?php echo "$_SERVER[PHP_SELF]" ?>  >
        Enter File Name : <input type="text" name="fnm" /><br /><br />
            Enter file content : <textarea cols="100" rows="25" name="msg"></textarea><br /><br />
            <input type="submit" value="upload"  name="submit" />

No comments:

Post a comment