<?PHP
echo("
<form action='".$PHP_SELF."' method='POST'> 
<input type='hidden' name='sid' value='".trim($sid)."'>
".((isset($uid))?"<input type='hidden' name='uid' value='".trim($uid)."'>":"")."
".((isset($oid))?"<input type='hidden' name='oid' value='".trim($oid)."'>":"")."
<table width='725' cellpadding='2' cellspacing='0' border='0'>
	<tr>
		<td width='20%' align='left' valign='top'>Create Account for:</td>
		<td width='20%' align='left' valign='top'><select name='uid' ".$input_style.">
			<option value='0'".((isset($uid))?"".((trim($uid)=="0")?" selected":"")."":" selected").">A New Client</option>
	");
$row0=mysql_query("select uid, first_name, last_name, zip_code from user where status='0' order by first_name asc");
while ($rs0=mysql_fetch_row($row0))
	{
	echo"<option value='".$rs0[0]."'".((isset($uid))?"".(($uid==$rs0[0])?" selected":"")."":"").">".$rs0[1]." ".$rs0[2]." - ".$rs0[3]."</option>\n";
	}
echo("
		</select></td>
		<td width='60%' align='left' valign='top'><input ".$button_style." type='submit' name='submitx' value='Update Form &gt&gt'></td>
	</tr>
	<tr>
		<td colspan='3'><hr color='#F0EFED'></td>
	</tr>
</form>
<form action='".$PHP_SELF."' method='POST'> 
<input type='hidden' name='sid' value='".trim($sid)."'>
".((isset($uid))?"<input type='hidden' name='uid' value='".trim($uid)."'>":"")."
".((isset($oid))?"<input type='hidden' name='oid' value='".trim($oid)."'>":"")."
	<tr>
		<td width='20%' align='left' valign='top'>Search by Last Name:</td>
		<td width='20%' align='left' valign='top'><input ".$input_style." type='text' size='26' name='search_last_name'></td>
		<td width='60%' align='left' valign='top'><input ".$button_style." type='submit' name='submit_search' value='Update Form &gt&gt'></td>
	</tr>
	 ");
if (isset($list_all))
	{
	echo("
	</form>
	<tr>
		<td colspan='3'><hr color='#F0EFED'></td>
	</tr>
	<form action='".$PHP_SELF."' method='POST'> 
	<input type='hidden' name='sid' value='".trim($sid)."'>
	".((isset($uid))?"<input type='hidden' name='uid' value='".trim($uid)."'>":"")."
	".((isset($oid))?"<input type='hidden' name='oid' value='".trim($oid)."'>":"")."
		");
	$x=1;
	$tok = strtok($list_all, "|");
	while ($tok) 
		{
		$rsuser=mysql_fetch_row(mysql_query("select first_name, last_name, zip_code, status from user where uid='".addslashes(trim($tok))."'"));
		if ($rsuser[3]!=69)
			{
			if ($x==1)
				{
				$data="<option value='".$tok."'>".$rsuser[0]." ".$rsuser[1]." - ".$rsuser[2]."</option>\n";
				$x=2;
				}
			else
				{
				$data.="<option value='".$tok."'>".$rsuser[0]." ".$rsuser[1]." - ".$rsuser[2]."</option>\n";
				}
			}

		$tok = strtok("|");
		}
	
	// don't forget last one
	// $data.="<option value='".$rsuid[1]."'>".$rsuser[0]." ".$rsuser[1]." - http://".$rsuid[0]."</option>\n";

	echo("
		<tr>
			<td width='20%' align='left' valign='top'>Specify which user:</td>
			<td width='20%' align='left' valign='top'><select name='uid' ".$input_style.">
		");
	echo $data;
	echo("
			</select></td>
			<td width='60%' align='left' valign='top'><input ".$button_style." type='submit' name='submitx' value='Update Form &gt&gt'></td>
		</tr>
		");
	}
echo("
	<tr>
		<td colspan='3'><hr color='#F0EFED'></td>
	</tr>
</table>
</form>
	");
?>