woodplease
09-23-2010, 12:45 PM
Script Title: Dynamic Ajax Content
Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
I'm using the content div to dispaly a php page. This works fine.
There is a form in the php page that when submitted, reloads the php page, and runs code to insert the form data into a table, using if($_POST(submit)). the problem is that it is reloading main page,with the ajax on, not the div. This means that the if($_POST(submit)) does not run as the php page is no longer loaded in the div tag.
i've included both pages code.
<div id=\"fcontrol\">
<table border=\"1\" class=\"tstyle\">
<tr height=\"700\"><td valign=\"top\" class=\"ssbg\" width=\"120\"><div id=\"menu\">
<a href=\"javascript:ajaxpage('new_section.php', 'contentarea');\">Add new section</a><br/><br/>
<a href=\"javascript:ajaxpage('new_sub_section.php', 'contentarea');\">Add new section to forum</a><br/><br/><a href=\"index.php\">Back to forum</a><br/><br/></div></td><td class=\"tcontrol\" width=\"700\" valign=\"top\">
<center><div id=\"contentarea\">Control Panel</div></center></td></tr>
</table></div>
</div>
<form name="add_section" method="post" action="<?php echo $_SERVER['../PHP_SELF']; ?>">
<table>
<tr>
<td>Section Name</td>
<td><input type="text" name="section_title" maxlength="200" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="new_section" value="Add Section"/></td>
</tr>
</table>
</form>
Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
I'm using the content div to dispaly a php page. This works fine.
There is a form in the php page that when submitted, reloads the php page, and runs code to insert the form data into a table, using if($_POST(submit)). the problem is that it is reloading main page,with the ajax on, not the div. This means that the if($_POST(submit)) does not run as the php page is no longer loaded in the div tag.
i've included both pages code.
<div id=\"fcontrol\">
<table border=\"1\" class=\"tstyle\">
<tr height=\"700\"><td valign=\"top\" class=\"ssbg\" width=\"120\"><div id=\"menu\">
<a href=\"javascript:ajaxpage('new_section.php', 'contentarea');\">Add new section</a><br/><br/>
<a href=\"javascript:ajaxpage('new_sub_section.php', 'contentarea');\">Add new section to forum</a><br/><br/><a href=\"index.php\">Back to forum</a><br/><br/></div></td><td class=\"tcontrol\" width=\"700\" valign=\"top\">
<center><div id=\"contentarea\">Control Panel</div></center></td></tr>
</table></div>
</div>
<form name="add_section" method="post" action="<?php echo $_SERVER['../PHP_SELF']; ?>">
<table>
<tr>
<td>Section Name</td>
<td><input type="text" name="section_title" maxlength="200" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="new_section" value="Add Section"/></td>
</tr>
</table>
</form>