I have a 2 divs one for menu links and the other for content. What I want to be able to do is click a menu link and the page for that menu link to load in the content div.
I have already done this and it works. The problem is that the page inside the div contains a a form which does not come up with the success message and the database does not update.
All it does is either refresh to main content page or opens current window just as the content page or opens a new window with content page.
What solutions are there for this?
Logged_in.php
left div = menu
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".menuLink").click(function(){
$.ajax({
type: "POST",
url: $(this).attr('href'),
data: "",
cache: false,
success: function(html){ $("#Middle").html(html); }
});
});
});
</script>
</head>
<body>
<div id="head">
<div class="lefttop" align="center">
<div class="lefttopleft">
<a class="menuLink" href="Test.php" onclick="return false;"><img src="Images/logo.jpg" width="94" height="21" /></div>
When click on that link the page loads into the content div so now that page is showing with a form on in content div what I am having the trouble with is filling form out clicking submit and it updatung the database it just refreshes to main content div or just page loads the the file click on or does so in new window.
Test.php in content div
session_start();
include_once("connect.php");
include_once("functions.php");
if($_POST['WallSubmit'] && $_POST['Wall']){
$wall = makesafe($_POST['Wall']);
mysql_query("INSERT INTO `Wall` (`ID`, `Username`, `MessageBy`, `Date`, `Message`) VALUES ('', '', '$username', '" . time() . "', '$wall')");
}
?>
<body>
<form method="post">
<table class="default" style="width: 80%" align="center">
<tr>
<td class="subheader">Wall</td>
</tr>
<tr>
<td class="content">Post a comment.<br /><textarea name='Wall' id='Wall' style='width: 99%; height: 110px;'></textarea><br /><br/><center><input type='submit' value='Post' name='WallSubmit' /></center><br /><hr><br />Latest Comments.</td>
</tr>
</td>
</table>
</form>
</body>
</html>
Is there an easy way round this I have looked everywhere?