Hi,

I have two pieces of code that need to be amalgamated into one. As seperates they work great but as soon as they go together the 'dropdown list Javascript code' does not work. Can someone advise how to get these working togther?
So below is the main form. This is edited down a bit but contains the bulk of relevant code.

Code:
<body>
<script type="text/javascript" language="JavaScript">
<!--

function BothFieldsIdenticalCaseSensitive() {
var one = document.FormName.Email.value;
var another = document.FormName.Emailconfirm.value;
if(one == another) { return true; }
alert("Your email addresses do not match.");
return false;
}

function BothFieldsIdenticalCaseInsensitive() {
var one = document.FormName.Email.value.toLowerCase();
var another = document.FormName.Emailconfirm.value.toLowerCase();
if(one == another) { return true; }
alert("Your email addresses must be identical.");
return false;
}


//-->

<!--
      function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
      //-->
</script>

<h2>Add your attraction here</h2>  
<p>Please share your attraction:</p>  
<form enctype="multipart/form-data" method="post" action="add_attraction01.php" FORM NAME="FormName">    
<input type="hidden" name="MAX_FILE_SIZE" value="32768" />    <label for="Business_name">Business Name</label>    
<input type="text" size="60" STYLE="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; background-color: #72A4D2;"     
<id="Business_name" name="Business_name" maxlength=60/><font size="1" face="arial" color="red">Required field</font><br />    
<label for="StreetAddress">Address</label>    
<input type="text" size="60" rows="2" id="StreetAddress" name="StreetAddress" maxlength=120/><font size="1" face="arial" color="red">Required field</font><br />    
<label for="Town">Town</label>    <input type="text" size="25" id="Town" name="Town" maxlength=25/><font size="1" face="arial" color="red">Required field</font><br /> 
<?php
$link = mysql_connect('myhostname', 'myusername', 'mypassword') or die('Could not connect: ' . mysql_error());
mysql_select_db('mydatabase') or die('Could not select database');
$query = "select `CountyID`,`County`, 'Regions' from `county_regions`";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
?>
<label for="County">County</label> 
<select name="County">
<option value=''></option>
<?php
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
  echo '<option value="'.$row['County'].'"'.
(isset($_SESSION['County']) && $_SESSION['County'] == $row['County'] ? 'selected="selected"' : '').'>'.        
$row['County'].'</option>';}
?>
</select>
<font size="1" face="arial" color="red">Required field</font><br />   
<br />    
<br />    
<label for="Postcode">Postcode</label>    
<input type="text" size="7"id="Postcode" name="Postcode" maxlength=7/><font size="1" face="arial" color="red">Required field</font><br />    
<label for="Tel_No">Contact Number</label>    
<input type="text" size="20"id="Tel_No" name="Tel_No" maxlength=20 onkeypress="return isNumberKey(event)"/><font size="1" face="arial" color="red">Required field</font><br />    
<br/>    
<label for="Website_address">Website address</label>    
<input type="text" size="60" id="Website_address" name="Website_address" maxlength=60/><br />    
<label for="Email">Contact email</label>    <input type="text" size="45" id="Email" name="Email" maxlength=45/><br />    
<label for="Emailconfirm">Re-enter email</label>    <input type="text" size="45" id="Emailconfirm" name="Emailconfirm" maxlength=45/><br />    

<br />    
<input type="submit" value="Submit your attraction" name="submit" onclick="return BothFieldsIdenticalCaseSensitive();"/>   
</form>
</body>
</html>
In order to achieve a dropdown box or textbox called "Region" which populates upon selection of "County", I have the following code - which works as it is.

Code:
<script language="JavaScript">

function autoSubmit()
{
var formObject = document.forms['theForm'];
formObject.submit();
}

</script>

</head>
<body>

<?php

$link = mysql_connect('myhost', 'myusername', 'mypassword') or die('Could not connect: ' . mysql_error());
mysql_select_db('mydatabase') or die('Could not select database');

if(isset($_GET["County"]) && is_numeric($_GET["County"]))
{
$County = $_GET["County"];
}

if(isset($_GET["Region"]) && is_numeric($_GET["Region"]))
{
$Region = $_GET["Region"];

}

?>

<form name="theForm" method="get">

<select name="County" onChange="autoSubmit();">
<option value=''</option>

<?php


$sql = "SELECT * FROM county_regions";
$counties = mysql_query($sql,$link);

while($row = mysql_fetch_array($counties))
{
echo ("<option value=\"$row[CountyID]\" " . ($County == $row["CountyID"]? " selected" : "") . ">$row[County]</option>");
 }

?>

</select>

<?php

?>

<br><br>

<?php

if($County!= null && is_numeric($County))
{

?>

<select name="Region" onChange="autoSubmit();">


<?php


$sql = "SELECT * FROM county_regions WHERE CountyID = $County ";
$Regions = mysql_query($sql,$link);

while($row = mysql_fetch_array($Regions))
{
echo ("<option value=\"$row[CountyID]\" " . ($Region == $row["CountyID"]? " selected" : "") . ">$row[Region]</option>");

}
?>

</select>

<?php

}

?>
So above I have two sets of codes which independently work fine. However, I need to combine them. I also need to retain anything that has already been entered into the form.

My first attempt at combining caused the data already entered onto the page to dissappear. My second attempt - the Javascript did not work and the second box was not populated. If anyone can suggest how I can combine these two pieces of code so that the page works it would be great!
Oh one more thing - the drop down box after the 'County' has been selected needn't be a drop down box at all becuase the County is only in one Region eg Hampshire is in the South East - so can this just be printed on the page?
All values will submit to a mysql database.

Many thanks for your time