I have an accordion in which I have placed a form inside of each accordion panel. I have figured out how to make the panel stay open after clicking the panel heading when the page is refreshed. The problem I am having is getting the panel to stay open after the submit button inside the form is clicked. I want to be able to see the new data that was added to the database without having to open the panel again after the form is submitted.
Here is what I currently have:
<script type="text/javascript" src="_js/test/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="_js/test/jquery-ui-1.8rc2.custom.min.js"></script>
<script type="text/javascript">
jQuery().ready(function(){
$('#accordion').accordion({
autoHeight: false,
navigation: true,
header: '.menu-item'
});
$(".menu-item").click(function(event){
window.location.hash=this.hash;
});
});
</script>
<style>
#accordion a.menu-item {
cursor:pointer;
display:block;
margin-top: 0;
text-decoration: none;
outline:0;
clear: both;
}
</style>
<div id="accordion">
<!-- EMAIL ADDRESSES -->
<a class="menu-item" href="#1" title="First Menu Item" name="1">Email Addresses</a>
<div class="slider">
<div class="data_entry2">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="ww_form1" id="ww_form1">
<div class="field-slider">
<label for="name">Name</label>
<input name="name" type="text" size="40" maxlength="60">
</div>
<div class="field-slider">
<label for="email">Email Address</label>
<input name="email" type="text" size="40" maxlength="60">
</div>
<div class="error3">
<?php echo "<span>$error</span>"; ?>
</div>
<div class="controls3">
<input type="submit" name="add_email" id="add_email" value="Add Email Address">
</div>
</form>
</div><!-- end of data_entry2 -->
<div id="email"><h3>Current Email Addresses:</h3>
<?php
$conn = mysql_connect("localhost","user","pass") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db("database", $conn) or trigger_error("SQL", E_USER_ERROR);
$sql = "SELECT * FROM email ORDER BY email_drop ASC";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
while($row = mysql_fetch_assoc($result))
{
echo "<a href=admin.php?action=del&id=".$row['id']."><img src=\\"_images/delete.jpg\\" alt=\\"delete\\" width=\\"12\\" height=\\"12\\" border=\\"0\\" /></a>";
echo " ";
echo "<span class=\\"bold charcoal\\">" . $row['name'] . " - " . "</span>";
echo " ";
echo "<span class=\\"italic\\">" . $row['email_drop'] . "</span>";
echo "<br />";
}
?>
</div><!-- end of machinenum -->
</div><!-- end of slider -->
<!-- END OF EMAIL ADDRESSES -->
<div class="clear"></div>
<!-- MACHINE NUMBER -->
<a class="menu-item" href="#2" title="First Menu Item" name="2">Machine Number</a><!--</p>-->
<div class="slider">
<div class="data_entry2">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="ww_form1" id="ww_form1">
<div class="field-slider">
<label for="machinenum">Machine #</label>
<input name="machinenum" type="text" size="6" maxlength="6">
</div>
<div class="error3">
<?php echo "<span>$error2</span>"; ?>
</div>
<div class="controls4">
<input type="submit" name="add_machinenum" id="add_machinenum" value="Add Machine #">
</div>
</form>
</div><!-- end of data_entry2 -->
<div id="machinenum"><h3>Current Machine Numbers:</h3>
<?php
$conn = mysql_connect("localhost","user","pass") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db("database", $conn) or trigger_error("SQL", E_USER_ERROR);
$sql = "SELECT * FROM machinenum ORDER BY machinenum_drop ASC";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
while($row = mysql_fetch_assoc($result))
{
echo "<div class='result'>";
echo "<a href=admin.php?action=del&id=".$row['id']."><img src=\\"_images/delete.jpg\\" alt=\\"delete\\" width=\\"14\\" height=\\"14\\" border=\\"0\\" /></a>";
echo " ";
echo $row['machinenum_drop'];
echo "</div>";
}
?>
</div><!-- end of machinenum -->
</div><!-- end of slider -->
<!-- END OF MACHINE NUMBER -->
</div><!-- end of accordion -->
Any help is greatly appreciated. Thanks for any help!