<?php
#This page gathers the name so that we can write an NDA on the next page.
require("includes/.htconfig.php");

$gender="";		##I use it later in the form and don't want to be throwing an error.
if (array_key_exists("command",$_REQUEST) && $_REQUEST["command"] == "Submit")
{
	$first_name=fromRequest("first_name");
	$middle_name=fromRequest("middle_name");
	$last_name=fromRequest("last_name");
	$gender=fromRequest("gender");
  
	$street_line_01=fromRequest("street_line_01");
	$street_line_02=fromRequest("street_line_02");
	$street_line_03=fromRequest("street_line_03");
	$city=fromRequest("city");
	$state=fromRequest("state");
	$zipCode=fromRequest("zipCode");
	$country=fromRequest("country");
  
	if (is_null($first_name) && is_null($middle_name)) $errmsgs.="<BR>You need to give us your given name.";
	if (is_null($last_name)) $errmsgs.="<BR>You need to give us your surname.";
	if (strlen($errmsgs) == 0)
	{
    $_SESSION['enrollee']['first_name']=$first_name;
    $_SESSION['enrollee']['middle_name']=$middle_name;
    $_SESSION['enrollee']['last_name']=$last_name;
    $_SESSION['enrollee']['gender']=$gender;

    $_SESSION['address']['street_line_01']=$street_line_01;
    $_SESSION['address']['street_line_02']=$street_line_02;
    $_SESSION['address']['street_line_03']=$street_line_03;
    $_SESSION['address']['city']=$city;
    $_SESSION['address']['state']=$state;
    $_SESSION['address']['zipCode']=$zipCode;
    $_SESSION['address']['country']=$country;
			loggywoggy("start.php is done, moving on");
			advancePage($newby);
	}
}
include ("includes/headstart.php");
?>
<title>What's Your Name?</title>
<script language="JavaScript">
function validate()
{
	var is_valid=true
	is_valid = blank_check( document.frm.first_name.value, "Please give us your first name." )
		if( is_valid == false ) { document.frm.first_name.focus(); return is_valid }

	is_valid = blank_check( document.frm.last_name.value, "Please give us your surname." )
		if( is_valid == false ) { document.frm.last_name.focus(); return is_valid }
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
    <td align="center" valign="top">

      <?php
include_once("includes/header.php");
?>
      <form name="frm" method="post" action="" enctype="multipart/form-data" onSubmit="return validate()">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="30%" valign="top">
              <div class="bodySubHeader">
                <span class="bsht03">Step 1: Data for the NDA</span>
              </div>
            </td>
          </tr>
        </table>
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="DarkLightBox">
          <?php
	if(strlen($errmsgs) > 0)
	{
	?>
          <tr>
            <td height="30" align="center" valign="top" colspan="8">
              <strong>
                <?=$errmsgs?>
              </strong>
            </td>
          </tr>
          <?php
	}
	?>
	<tr><td colspan=9>We have recorded your provisional certificate and now we want to construct your ValID<sup>TM</sup> certificate.
	Before we start to gather all of your personal information, we first want to enter a contract wherein you tell us what we're allowed to do with your personal information.
	To write this contract, we need your name and sex.
	When you submit this information to us, we shall send you back a contract digitally signed by our CEO in which you give us
	permission to use the information to satisfy us as to your identity.
	Beyond that use, we are not permitted to go without your further permission.
          <tr>
            <td width="65%" align="left" valign="top" colspan="8" class="TopMenu2">Personal Details</td>
          </tr>
          <tr>
            <td align="left" valign="top" colspan="8">&nbsp;</td>
          </tr>
          <tr>
            <?PHP
				$spacer="<td height=\"30\" align=\"left\" valign=\"top\" width=\"1%\">&nbsp;</td>";
				echo inputCells("First Name$redstar","first_name");
				echo $spacer.inputCells("Middle Name","middle_name");
				echo $spacer.inputCells("Surname$redstar","last_name");
			?>
          </tr>
          <tr>
            <td height="30" align="left" valign="top" class="browseEventContents">Sex:</td>
            <td height="30" align="left" valign="top">
              <select name="gender">
				<?PHP
				echo "<option value=\"m\"".if_selected($gender == "m")."Male</option>";
				echo "<option value=\"f\"".if_selected($gender == "f")."Female</option>";
				?>
              </select>
            </td>
          </tr>
          <tr>

          </tr>
          <TR valign="top">
            <td colspan="6">
              <TABLE>
                <TR>
                  <td width="65%" align="left" valign="top" colspan="8" class="TopMenu2">Residential Address</td>
                </TR>
                <TR>
				<?PHP
					echo inputCells("Street Address$redstar","street_line_01");
				?>
                </TR>
                <TR>
				<?PHP
					echo inputCells("","street_line_02");
				?>
                </TR>
                <TR>
				<?PHP
					echo inputCells("","street_line_03");
				?>
                </TR>
                
                <tr>
				<?PHP
					echo inputCells("City$redstar","city");
					echo "<td height=\"30\" align=\"left\" valign=\"top\" class=\"browseEventContents\">State$redstar:</td><td height=\"30\" align=\"left\" valign=\"top\"><SELECT name=state>";
          echo spew_options($link,"select * from state where country_id=223 order by state_name","state_code","state_name");
          echo "</SELECT></td>";
					echo $spacer.inputCells("Zip Code$redstar","zipCode");
				?>
                </tr>
                <tr>
                  <?PHP
					echo "<td height=\"30\" align=\"left\" valign=\"top\" class=\"browseEventContents\">Country:</td><td height=\"30\" align=\"left\" valign=\"top\"><SELECT name=country>";
          echo spew_options($link,"select * from country order by country_name","inet","country_name","us");
          echo "</SELECT></td>";
                  ?>
                </tr>
              </TABLE>
			</td>
      </TR>


          
        
      </tr>
	 <tr>
	   <td height="35" align="left" valign="bottom" colspan="7">&nbsp;</td>	   
	   <td height="35" align="left" valign="bottom"><input name="command" type="submit" value="Submit" /></td>
	 </tr>
	</table>
</form>
<?php
include_once("includes/footer.php");
?>
	   </td>
	 </tr> 	 
</table>
</body>
</html>
