i have a username/password <form>
and if false, will display invalid users, if true will display a <textarea>
and users can comment then submit.
basically, the code below, is the then
statement that if login is correct then..
session_start();
$_SESSION['name'] = $name;
echo "success, hi $name";
echo "<table>
<tr><td>insert comment here</td><td>poster</td>
<tr><td><form action='post.php' method='post'><textarea name='content'></textarea>
</td>
<td> $name</td>
</tr>
<input type='submit' name='submit' value='submit'>
</form>
</table>";
in relation to the <form>
above, i created post.php which will parse all data coming from the <form>
and insert it into the database.
<?php
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("data") or die (mysql_error());
?>
<?php
if (isset($_POST['submit'])) {
$cont = $_POST['content']; //data coming from index.php <form>
mysql_query("insert into data ('content') values ('$cont')");
}
else {
}
?>
what baffles me, is there are no errors being shown.
when I input something on my <textarea>
then clicked submit, it goes to localhost/post.php but when i refresh to the index page, the submitted data was not saved/recorded to the database.