JavaScript和PHP中的数据提交

I have a set button before the user submits a registration, where I need to set html before the server submits the php code. However, I cannot seem to get this working, any suggestions? I;am using typeahead.js for the input. (Full Name works perfectly)

<div class="col-md-6 col-sm-12 col-xs-12">
   <div>
 <?php $full_name = 'akID[' . UserAttributeKey::getByHandle('full_name')->getAttributeKeyID() . '][value]'; ?>
        <?php echo $form->label($full_name, t('Full Name')); ?>
        <?php echo $form->text($full_name); ?>
   </div>
   <br/>
<form id="school" onclick="doThis()">
<?php $school = 'akID[' . UserAttributeKey::getByHandle('school')->getAttributeKeyID() . '][value]; ?>]'; ?>
   <?php echo $form->label($school, t('Please Select your School from the Dropdown Box.') )?><br/>
    <input type=text id="school" name="school" class="form-control typeahead" value="Enter Your School ">
      <input type="button" value="Set" onsubmit="setSchool();"/>
</form>


<script>
function setSchool()
{
 var school = $("#school").val();
 $school = $_POST(school);
}
</script>


</div>
</form>

You cannot have the same id for form and input. Change or remove id attribute from school input, add method='post' to the form and change your function setSchool to:

function setSchool()
$('input[name="school"]).val("<?php echo json_encode($_POST["school"]); ?>");
 $("#school").submit();
}