Jump to content


Check out our Community Blogs

microblogpl

Member Since 25 Jul 2012
Offline Last Active Jul 26 2012 12:18 AM
-----

#634534 How To Make A Php Script To Create A Html File?

Posted by microblogpl on 25 July 2012 - 12:46 AM

Hi!
Well.... I want to know how to make a script to create a html page. So when the script is executed, it will create a new page. Something like this: mydomain.com/test.html . The script should create the test.html page! Thanks in advanced......! :laugh:

Here is my work:

<form action="index.php" method="post">
<input type="text" name="nick" value="Enter NIck" />
<input type="submit" value="Create" />
</form>

<?php

$nick=$_POST['nick'];	  // get the users input

$fh=fopen('$nick' , 'W')	// Create the page
$contents= include 'sys.php';
fwrite($fh, $contents);
fclose($fh);

echo "Redridectring to your page....";

header('Location: $nick');

?>

Now, what this code should do is create a page, which is called
$nick. So if the input is "bleugh", the $nick should be $nick="bleugh".
Then it will create the page "bleugh", include sys.php, then header to the
page. Is this wright? Plz answer! :rules:

follow me on twitter:
@microblogpl
  • 1


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download