<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

      <div class="main my-0">
        <div class="row mt-3 mx-0">
          <div class="col-md-6">
            <h3><?php echo $pgheading;?></h3>
          </div>
          <div class="col-md-5 text-right">
            &nbsp;
          </div>
        </div>
        
        <div class="container_fluid mt-2 px-3">
		<form name="frmgeneral" method="post" action="account/<?php echo $mgmtname;?>/managemergedata" enctype="multipart/form-data" onsubmit="return checkdata();">
		<input type="hidden" name="rsrcid" value="<?php echo $rsrcid;?>">                
        <table class="webforms mt-0 table-responsive-sm">
         <tr>
          <td width="20%"><label>From Item:</label></td>
          <td width="80%">
		  <select name="fromproductid" id="fromproductid" required class="js-example-basic-single">
		  <option value="">Select From Item</option>
			<?php
				if(is_array($rsproducts))
				{
					foreach($rsproducts as $kvalue)
					{
						$sel_pt ="";
				?>
									<option value="<?php echo $kvalue->fld_id;?>" <?php echo $sel_pt;?>><?php echo $kvalue->fld_name;?></option>
							<?php
					}
				}
			?> 
		  </select>
		  </td>
         </tr>
         <tr>
          <td width="20%"><label>To Item:</label></td>
          <td width="80%">
		  <select name="toproductid" id="toproductid" required class="js-example-basic-single">
		  <option value="">Select To Item</option>
			<?php
				if(is_array($rsproducts))
				{
					foreach($rsproducts as $kvalue)
					{
						$sel_pt ="";
						/*if($info4edit->fld_fromproductid==$kvalue->fld_fromproductid)
						{
							$sel_pt = 'selected="selected"';
						}*/				
							?>
									<option value="<?php echo $kvalue->fld_id;?>" <?php echo $sel_pt;?>><?php echo $kvalue->fld_name;?></option>
							<?php
					}
				}
			?> 
		  </select>
		  </td>
         </tr>
    
		 <tr>
             <td></td>
             <td><button class="btn btn-danger">Submit</button></td>
         </tr>
         </table>
         </form> 
	         <div class="clearfix"></div>          
        </div>
       </div>
<script>
function checkdata()
{
	var fromproductid = $("#fromproductid").val();
	var toproductid = $("#toproductid").val();
	if(fromproductid!="" && toproductid!="")
	{
		if(fromproductid==toproductid)
		{
			alert("Please select different item");
			return false;
		}
		else
		{
			return true;
		}
	}
}
</script>
