Jump to content

fwrite, and post function not working.


Recommended Posts

I am trying to make a basic PHP script that will take the data from a form and post it on a page, like a commenting thing. but for some reason, the script is not writing in the page! here are the srcipts:form page:

<body><form action="post.php" method="post"><input type="text" name="name"><br><textarea name="comment"></textarea><br><input type="submit" value="post comment"><br></form></body>

PHP page:

<?php$myFile = "htmllab2-0_blog.php";$fh = fopen($myFile, 'a') or die("Failed");$name = $_POST["name"];$comment = $_POST["comment"];$main = "\n<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr>\n<td align='left'> By \n" . $_POST["name"] . "\n<br><br>\n" . $_POST["comment"] . "\n</td></tr>\n<!-- --!>\n<!-- --!>\n<!-- --!>";fwrite($fh, $main);fclose($fh);echo "...";?>

the page that gets writen on (named 'htmllab2-0_blog.php', and yes the pages are all in the same folder...) :

<body><table boder="1"><tr></tr><td>See what other people think about the HTML Lab below.</td></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>

all of the pages work, but when the computer views the posting page, it doesn't write on the htmlab_blog page!do you see what's wrong?

Link to comment
Share on other sites

Wait for a mod to do so - anyway, others can still learn from your code, comment, and discuss.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...