

<?php
	if($_SESSION['p']==1) {
		    $_SESSION['account_name'] = $_GET['account_name_text'];
	}
	
	$query = "SELECT account_name FROM rad_suppliers WHERE account_name = '". $_SESSION['account_name']."'" ;
	$result = mySQL_query($query) or die ("Error in query:   $Query . * ". mySQL_error());
	$num = mysql_num_rows($result);
	if ($num!=0) { 
	$_SESSION['error']=1;
	$_SESSION['p']=1;
	
	?>
    <script language="javascript" type="text/javascript">
        <!--
		needToConfirm = false;
	 window.location="supplierWizbase.php?s=0&p=1";
        -->
     </script>

<?php	
       }
    else{
	
	

   include ('../include/formValidations.php')
?>




<?php 
   include ('../include/formValidations.php')
?>


<?php

$table_name = "rad_list_places";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	$table_name = "rad_list_country";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}

?>

<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>  <!--form validation-->
<script type="text/javascript" src="../css/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script language="javascript" type="text/javascript" >
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='supplierList.php'
if (okToRefresh)
	{
			window.location=url;
	}
}
// -->
</script>
<script language="JavaScript">
  var needToConfirm = true;
  window.onbeforeunload = confirmExit;
   function confirmExit()
  {
    if (needToConfirm)
      return "You did not finish the wizard./nIf you leave now your data will not be saved.";
  }
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
</script>
<form id="feedbackform" method="get" action="supplierWizbase.php">
  <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
          <tr>
            <td width="525" >
            <p class="wizard">
                <label class="std">Is this a 'cash' or 'credit' account?</label>
              &nbsp;&nbsp;&nbsp;&nbsp;
              <label class="std">
                <input type="radio" name="cash_credit_group" value="credit" id="cash_credit_group_0" <?php if ($_SESSION['credit_cash']=="credit") { echo "checked='checked' " ;} ?> />
                credit</label>
              
              <label class="std">
                <input type="radio" name="cash_credit_group" value="cash" id="cash_credit_group_1"  <?php if ($_SESSION['credit_cash']=="cash") { echo "checked='checked' " ;} ?>/>
                cash</label>
              
            </p>
            
            <p class="wizard">
                <label class="left">Postal address:</label>
                <select name="AddressText1" class="wizard2" id="box">
                  <option value="PO Box">PO Box</option>
                  <option value="P Bag">P Bag</option>
                  <option selected="selected"><?php echo $_SESSION['AddressText1'] ?></option>
                </select>
                <input name="AddressText2" type="text" class="wizard2" id="postal address" onkeyup="ToUpper(this)" value="<?php echo $_SESSION['AddressText2'] ?>" /><label class="star">*</label>
                <label class="right">&nbsp;&nbsp;&nbsp;Place:&nbsp;&nbsp;&nbsp;</label>
                <span class="right">
                <select name="PlaceText" class="wizard1"  >
                  <option value="<?php echo $_SESSION['PlaceText'] ?>" selected="selected"><?php echo $_SESSION['PlaceText'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                </select>
                </span>
                <label class="star">*</label><br />
              </p>
              <p class="wizard">
                <label class="left">Physical address:</label>
                <input name="AddressText3" type="text" class="wizard1" id="physical address"  onblur="capitalize(this)" onkeyup="ToLower(this)" value="<?php echo $_SESSION['AddressText3'] ?>"/>
                <label class="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Place:&nbsp;&nbsp;&nbsp;</label>
                <span class="right">
                <select name="PlaceText2" class="wizard1"  >
                  <option value="<?php echo $_SESSION['PlaceText2'] ?>" selected="selected"><?php echo $_SESSION['PlaceText2'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                </select>
                </span><br />
                <br />
                <label class="left">Country:</label>
                <select name="CountryText" class="wizard1"  >
                  <option value="<?php echo $_SESSION['CountryText'] ?>" selected="selected"><?php echo $_SESSION['CountryText'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
                </select>
                <label class="star">*</label>
                <input name="p" type="hidden" id="p" value="2" />
                <input name="s" type="hidden" id="s" value="2" />
              </p></td>
            <!--center of tableMain-->
          </tr>
          <tr>
            <td><!--center of tableMain-->
              <table width="590" height="50" align="center" id="tableButtonBar">
                <tr>
                  <td width="117"><input type="submit" name="prev_button" id="prev_button" class="imagebutton" value="Prev" onclick=" needToConfirm = false; " /></td>
                  <td width="115">&nbsp;</td>
                  <td width="99">&nbsp;</td>
                  <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onclick="needToConfirm = false; confirmRefresh();" value="Cancel" /></td>
                  <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onclick="needToConfirm = false; " /></td>
                </tr>
              </table></td>
          </tr>
        </table>
  </table>
  <!--end of tableMain-->
</form>
<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("AddressText1","req","Please select box or bag.");
  frmvalidator.addValidation("AddressText2","req","Please enter a box or bag number.");
  frmvalidator.addValidation("PlaceText","req","Please select a city.");
  frmvalidator.addValidation("CountryText","req","Please select a country.");
  frmvalidator.addValidation("cash_credit_group","selone","Please select credit or cash.");
  </script>

<?php
	}
	?>