My code to process the Form and stay on the same page is not altogether doing what I hoped.
When I enter a value into the form and click submit, it adds the value to the database but then the form vanishes!
How can I get it to always show the form?
Code is below...
<?php
if (isset($_POST["Submit"])) {
// form processing items
$dbh=mysql_connect ("localhost", "alwaysac", "xxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("alwaysac_MyArticles");
mysql_query("insert into Articles (TopicName) values
('$Topic')");
} else {
?>
<form name="form1" method="post" action="pea.php">
<p> </p>
<table width="200" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Topic</td>
<td><input name="Topic" type="text" id="Topic"></td>
</tr>
<tr>
<td>MetaTitle</td>
<td><input name="MetaTitle" type="text" id="MetaTitle"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
<p> </p>
<p> </p>
</form>
<?php
}
?>