<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
echo"<form action='contribute.php' method='post'>
<table>
<tr>
<td>Title:</td>
<td><input type='text' name='title' style='width: 200px;'/></td>
</tr><tr>
<td>Content:</td>
<td><input type='text' name='content' style='width: 200px;'/></td>
</tr><tr>
<td>Author:</td>
<td><textarea type='text' name='author' style='width: 200px; height= 100px'/></textarea></td>
</tr><tr>
<td></td>
<td><input type='submit' name='postbtn' values='post'/></td>
</tr>
</table>
</form>";
$title=strip_tags($_POST['title']);
$content=strip_tags($_POST['content']);
$author=strip_tags($_POST['author']);
if($title && $content && $author){
echo "You have entered the required infromation";
file_put_contents('test22.txt','this is a test');
}
else
echo "You have not entered the required infromation";
?>
</body>
</html>
I am trying to create a form on one of my webpages, that when filled in creates another webpage. I have created the form but I don't know how I can use this to create another webpage. My idea was to write to make the code create a html file into my directory. But when I fill out the form I always get 'Internal Server Error' back - indicating that it is not letting me create a html file. Any ideas of how I can do this?
Aucun commentaire:
Enregistrer un commentaire