show hidden div after page refresh
Hi Guys,
I'm not sure if I can do this in php or javascript, but I have a problem.
When the user clicks on checkbox, the hidden div (calendar) shows up. However, after he submits and page reloads- due to an empty required field- the checkbox stays ticked but the calendar dissapears. Which I think is because javascript goes back to default stage. Although the box appears ticked, I have to untick and tick again for calendar to reshow.
Is there a way I can make the calendar show up once the page refreshes?
Any help appreciated,
Thank you.
Code JavaScript:
<script type="text/javascript">
<!--
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
//-->
</script>
HTML Code:
<form action="register-civ.php" method="post" name="go">
<input type="checkbox" name='c2' value="check me 2" onclick="showMe('div1', this)"
<?php echo $name_text = isset($_REQUEST['c2']) ? 'checked':'';?> /> Specific date<p/>
<div id="div1" style="display:none">
a calendar I have for the user
</div>
<input name="submit" value="Submit" type="submit" /></form>