Problme with show/hide div tag using php and javascript

hi, I am newbie to web development using php and javascript. I am creating a form and I want a dynamic look on my form. I am having a listbox and I want that according to selection “yes/no” a <div> tag is show & hide and for that I write a javascript code that is working fine according to selection. I am also doing form validation in php and if any error occurs it is displayed when we submit the form. But my problem is that when page is displayed with error, listbox selection is “yes” due to my php coding but the <div> tag is not visible because I call javascript showhide() function on onchange event. so I need some help here, I want to know that I where I should make changes in my code or write some more code or function in javascript or php or ajax, so that when page is displayed with error and listbox selection is “yes” that <div> tag should be displayed.
Here is my code:

$error_message = array();
if ($_POST['submit_reg'] != '')
{	$org = $_POST['org'];
	$benefit = $_POST['benefit'];
	if($org=="select")		$error_message[] = 'Are you a Member of our Organisation?';
	else if($org=="yes")	{ if($benefit=="select")	$error_message[] = 'Please select your Benefit or Allowance'; } }	
if($_POST['submit_reg'] == '' || count($error_message) > 0)
{	if (count($error_message) > 0)
	{	foreach($error_message as $val)
    	{    echo $val;   	}	}	}
<html><head><script type="text/javascript">
function showhide_func()
{	var mylist=document.getElementById("org");
	var myLayer = document.getElementById("layer").style;
<form method="POST"  onReset="return confirm('Are you sure you wish to clear the form?');" name="org_reg"  >
	<label>Are you a Member of our Organisation?</label>
		<select name="org" id="org" onchange="showhide_func()" on>
			<option value="select" <?php if ($org == 'select') echo "selected=\\"selected\\""; ?>> Select</option>
			<option value="no" <?php if ($org == 'no') echo "selected=\\"selected\\""; ?>> No</option>
			<option value="yes" <?php if ($org == 'yes') echo "selected=\\"selected\\""; ?>>Yes</option>
	<div id="layer" style="display:none" >
		<label>If YES, What Benefit or Allowance are you currently receiving?</label>
		<select name="benefit" id="benefit" >
			<option value="select" <?php if ($benefit == 'select') echo "selected=\\"selected\\""; ?>> Select</option>
			<option value="disability" <?php if ($benefit == 'disability') echo "selected=\\"selected\\""; ?>> Disability</option>
			<option value="aged" <?php if ($benefit == 'aged') echo "selected=\\"selected\\""; ?>> Aged</option>
	<input type="submit" value="Submit" name="submit_reg">
	<input type="reset" value="Reset" name="reset">

On this line:

<div id="layer" style="display:none" >

Do something like this instead:

if (isset($_POST['org']) && $_POST['org'] == "yes") {
  echo "<div id='layer' style='display: block'>";
} else {
  echo "<div id='layer' style='display: none'>";

Thank you for the solution.