0

Hi,
plz help me........
i have three php pages First is 'Outward.php', second is OutwardData.php and Third is OutwardGrid View.php.I want multiple checkbox records from 'Outwardgridview.php' to 'Outward.php' gridtable.


But my problem is only first record is display in outward.php gridtable.But display all checkbox no. my code is
---------------------------1.Outward.php--------------------------------------

<?php
session_start(); 
if(isset($_POST['submit1']))
{
change();
}
if(isset($_POST['submit']))
{
call();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;  charset=iso-8859-1" />
<title>Tradeworld Couriers</title>
<link rel="stylesheet" href="css/AdminStyleSheet.css" />
<script language="javascript" src="css/cal2.js"></script>
<script language="javascript" src="css/cal_conf2.js"></script>
<script type="text/javascript" src="ajax.js"></script>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
</script>

<script type="text/javascript">
var ajax3 = new Array();

function getText3List(sel)
{
	var PartyType = sel.options[sel.selectedIndex].value;
	document.getElementById('PartyName').options.length = 0;
	if(PartyType.length>0){
		var index = ajax3.length;
		ajax3[index] = new sack();
		
		ajax3[index].requestFile = 'getText.php?PartyType='+PartyType;
		ajax3[index].onCompletion = function(){ createText3(index) };
		ajax3[index].runAJAX();
	}
}

function createText3(index)
{
	var obj = document.getElementById('PartyName');
	eval(ajax3[index].response);	
}


var ajax4 = new Array();

function getText4List(sel)
{
	var PartyName = sel.options[sel.selectedIndex].value;
	document.getElementById('PartiesData').options.length = 0;
	if(PartyName.length>0){
		var index = ajax3.length;
		ajax4[index] = new sack();
		
		ajax4[index].requestFile = 'getText.php?PartyName='+PartyName;
		ajax4[index].onCompletion = function(){ createText4(index) };
		ajax4[index].runAJAX();
	}
}

function createText4(index)
{
	var obj = document.getElementById('PartiesData');
	eval(ajax4[index].response);	
}

</script>
</head>

<body>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">
<div id="header">
	<div class="logo"></div>
</div>
<center>

<table width="567" border="0">
  <tr>
   <?php
include "Config.php";

$query = "SELECT  MAX(AWBNo+1) FROM outward"; 
	 
$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
	$code=$row['MAX(AWBNo+1)'];
	}
?>
    <?php
 function change()
  {
  session_start();
  $_SESSION['date']=$_POST['txtDateTime'];
    $type=$_POST['select'];
	
		 
  if($type=="Branch")
  {
    $_SESSION['Branch']="selected='selected'";
  $_SESSION['Franchisee']=" ";
  }
  else{
  $_SESSION['Franchisee']="selected='selected'";
  $_SESSION['Branch']=" ";
  }
  
   if($partyname==$_POST['PartyName'])
  {
  $_SESSION['name']="selected='selected'";
    }
  else{
   $_SESSION['name']=' ';
  }
  header('Location:OutwardData1.php');
  }
  ?>
  <?php
  function call()
  {
  session_start();
  include "Config.php";
  $check=$_SESSION['Inward'];
    $str="insert into outward(DespatchDateTime,PartyCode,ReferenceNo) values('$_POST[txtDateTime]','$_POST[PartyName]',
  '$_POST[$check]')";
  $result=mysql_query($str) or die(mysql_error());
  $update="update inward set Status='Despatch' where InwardNo='$check'";
  $query=mysql_query($update) or die(mysql_error());
  mysql_close();
  }
  ?>
    <td colspan="6"><input type="submit" value="Save" name="submit" />
<input type="button" value="Find" onclick="parent.location='OutwardGrid1.php'" /></td>
    
  </tr>
  <tr>
    <td width="139">AWB No:</td>
    <td colspan="3"><input type="text" size="25px" name="txtAWBNo" disabled="disabled" value="<?php echo $code;?>" /></td>
  
  </tr>
  <tr>
    <td>Despatch Date:</td>
    <td colspan="3"><input type="Text" id="demo1" name="txtDateTime" maxlength="25" size="22" value="<?php echo $_SESSION['date'];?>"><a href="javascript:NewCal('demo1','ddmmmyyyy',true,24)"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date" title="Pick a date and time"></a></td>
   
  </tr>
  <tr>

    <td>Party Type:</td>
    <td width="106"><select id="select" name="select" onchange="getText3List(this)">
      <option value="">Select</option>
      <option value="Branch" <?php echo $_SESSION['Branch'];?>>Branch</option>
      <option value="Franchisee" <?php echo $_SESSION['Franchisee'];?>>Franchisee</option>
    </select></td>
	<td width="89">Party Name:</td>
	<td width="215"> <select id="PartyName" name="PartyName">
	 	  
	 <option value=" <?php echo $_SESSION['name'];?>">Select</option>
	 	</select>
		
		<input type="submit" value="Get Packets" name="submit1" /></td>
   
  </tr>
 
  
   
 
</table>

 </center>
 <div style="width:100%; height:100%; overflow:scroll">
<?php
session_start();
$inward=$_SESSION['select_records'];
if($inward)
{
include "Config.php";
$str="SELECT InwardNo,DateTime,parties.PartyName,PartyAWBNo,ContactPerson,Weight,Measurement,PacketDetail, city.CityName,inward.Remarks,Status FROM inward,parties,city WHERE inward.PartyCode = parties.PartyCode and inward.City = city.CityCode and InwardNo='$inward'";
$result=mysql_query($str) or die(mysql_error());

echo "<table width=100% border=0 align=center cellpadding=4 cellspacing=1 bordercolor=#333333 bgcolor=#999999 class=sample id=sortTable>
<tr style='font-weight:bold;color:#fff;background-color:#000000;'>
<th height=30 align=center>Inward No</th>
<th height=30>Date Time</th>
<th height=30>Party Name</th>
<th height=30>AWB No</th>
<th height=30>Contact Person</th>
<th height=30>Weight</th>
<th height=30>Measurement</th>
<th height=30>Packet Detail</th>
<th height=30>City</th>
<th height=30>Remarks</th>
<th height=30>Status</th>
</tr>";

while ($row=mysql_fetch_array( $result ) ) {
echo "<tr bgcolor=#F2F2F2>";
echo "<td align=center>". $row['InwardNo'] . "<input type=checkbox name=". $row['InwardNo'] . " id=". $row['InwardNo'] . " value=".$row['InwardNo'] . " /></td>";
echo "<td>". $row['DateTime'] . "</td>";
echo "<td>". $row['PartyName'] . "</td>";
echo "<td>". $row['PartyAWBNo'] . "</td>";
echo "<td>". $row['ContactPerson'] . "</td>";
echo "<td>". $row['Weight'] . "</td>";
echo "<td>". $row['Measurement'] . "</td>";
echo "<td>". $row['PacketDetail'] . "</td>";
echo "<td>". $row['CityName'] . "</td>";
echo "<td>". $row['Remarks'] . "</td>";
echo "<td>". $row['Status'] . "</td>";
echo "</tr>";
}

echo "</table>";


mysql_close();
}
?>
  </div>


</form>
</body>
</html>

------------------------------2.OutwardData.php-------------------------------

<?php 
if(isset($_POST['submit']))
{
call();
}
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Tradeworld Couriers</title>
<link rel="stylesheet" href="css/AdminStyleSheet.css" />
<script language="javascript" src="css/cal2.js"></script>
<script language="javascript" src="css/cal_conf2.js"></script>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
</script>

</head>

<body>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">
<div id="header">
	<div class="logo"></div>
</div>
<?php
function call()
{
session_start();
$_SESSION['fromdate']=$_POST['txtDate'];
$_SESSION['todate']=$_POST['txtDateTo'];
header('location:OutwardGridView1.php');
}
?>
<table width="593">
  <tr>
 
  <td width="38">
Date:</td>
<td width="189"><input type="text" id="demo1" name="txtDate" maxlength="25" size="20" value="<?php echo $_POST['txtDate'];?>"><a href="javascript:NewCal('demo1','ddmmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date" title="Pick a date and time"></a></td>
<td width="30">To:</td>
<td width="195"><input type="text" id="demo2" name="txtDateTo" maxlength="25" size="20" value="<?php echo $_POST['txtDateTo'];?>"><a href="javascript:NewCal('demo2','ddmmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date" title="Pick a date and time"></a></td>
<td width="65"><input type="submit" value="Get Data" name="submit" /></td>
</tr></table>



</form>
</body>
</html>

-----------------------------3.OutwardGridView.php---------------------------

<?php session_start();
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" href="css/AdminStyleSheet.css" />


</head>

<body>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">
<?php

/* Include the Pear::Pager file */
require_once ('Pager.php');
include "Config.php";

/* First we need to get the total rows in the table */
$result=mysql_query("SELECT count(*) AS total FROM inward");
$row = mysql_fetch_array($result);
 
/* Total number of rows in the logs table */
$totalItems = $row['total'];
 
/* Set some options for the Pager */
$pager_options = array(
'mode'       => 'Sliding',   // Sliding or Jumping mode. See below.
'perPage'    => 2,  // Total rows to show per page
'delta'      => 4,   // See below
'totalItems' => $totalItems);
 
/* Initialize the Pager class with the above options */
$pager = Pager::factory($pager_options);
 


 
/* The following code will retreive the result using the pager options */
 
/* The function below will get the page offsets to be used with
the database query. For e.g if we are on the third page then the
$from variable will have the value of '21' (we are showing 10 items per 
page, remember) and the $to variable will have the value of '30'.
*/
list($from, $to) = $pager->getOffsetByPageId();
/* The MySQL 'LIMIT' clause index starts from '0', 
    so decrease the $from by 1 */
$from = $from - 1;
 
/* The number of rows to get per query */
$perPage = $pager_options['perPage'];

$fromdate=$_SESSION['fromdate'];
$todate=$_SESSION['todate'];
$query2="SELECT InwardNo,DateTime,parties.PartyName,PartyAWBNo,ContactPerson,Weight,Measurement,PacketDetail, city.CityName,inward.Remarks,Status FROM inward,parties,city WHERE inward.PartyCode = parties.PartyCode and inward.City = city.CityCode and Status='Received' and DateTime BETWEEN '$fromdate' and '$todate'";
$result2=mysql_query($query2);
echo mysql_error();
/////// The variable nume above will store the total number of records in the table////

/////////// Now let us print the table headers ////////////////
$bgcolor="#f1f1f1";
echo "<TABLE name=grid width=100% align=center border=0  cellpadding=0 cellspacing=1 bordercolor=#333333 bgcolor=#999999 class=sample id=sortTable  > <tr   style='font-weight:bold;color:#fff;background-color:#000000;' >";
echo "<td  bgcolor='dfdfdf' >&nbsp;<font color='#000000'>Inward No</font></td>";
echo "<td  bgcolor='dfdfdf' >&nbsp;<font color='#000000'>Date Time</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000'>Party Name</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >AWB No</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000'>Contact Person</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >Weight</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >Measurement</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >Packet Detail</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >City</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000'>Remarks</font></td>";
echo "<td  bgcolor='dfdfdf'>&nbsp;<font color='#000000' >Status</font></td></tr>";

////////////// Now let us start executing the query with variables $eu and $limit  set at the top of the page///////////
$result = mysql_query("SELECT InwardNo,DateTime,parties.PartyName,PartyAWBNo,ContactPerson,Weight,Measurement,PacketDetail, city.CityName,inward.Remarks,Status FROM inward,parties,city WHERE inward.PartyCode = parties.PartyCode 
and inward.City = city.CityCode and DateTime BETWEEN '$fromdate' and '$todate' LIMIT $from , $perPage");


//////////////// Now we will display the returned records in side the rows of the table/////////
while($row = mysql_fetch_array($result))
{
if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}
else{$bgcolor='#f1f1f1';}

echo "<tr>";
echo "<td align=center bgcolor=$bgcolor id='title'>". $row['InwardNo'] . "<input type='checkbox' name='checkbox[]' id='checkbox[]' value=".$row['InwardNo'] . " /></td>";
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[DateTime]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[PartyName]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[PartyAWBNo]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[ContactPerson]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[Weight]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[Measurement]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[PacketDetail]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[CityName]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[Remarks]</font></td>"; 
echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Verdana' size='2'>$row[Status]</font></td>";
echo "<td>" . "<form method='post'><input type='hidden'   value='".$row['InwardNo']."'  name='InwardNoGet' /><input type='submit' value='Go'></form>" . "</td>";
echo "</tr>";
}
echo "</table>";
/* Display the links */
echo "<center>".$pager->links."</center>";

mysql_close();
?>

<table><tr><td><input type="submit" value="Submit" name="submit"/></td><td><input type="button" value="Back"  onclick="parent.location='Outward1.php'"/></td><td><input name="delete" type="submit" id="delete" value="Delete"></td>
<?php
include "Config.php";
// Check if delete button active, start this 
if(isset($_POST["delete"])){
$checkbox=$_POST['checkbox'];
for($i=0;$i<count($checkbox);$i++){
$delete_records = $checkbox[$i];
$sql = "DELETE FROM inward WHERE InwardNo='$delete_records'";
$result = mysql_query($sql);
echo "Row deleted!";
}
}
?>
<?php
include "Config.php";
session_start();
// Check if delete button active, start this 
if(isset($_POST["submit"])){
$checkbox=$_POST['checkbox'];
for($i=0;$i<count($checkbox);$i++){
$select_records .= $checkbox[$i].',';
$_SESSION['select_records']=$select_records;
}
header('location:Outward1.php');
}
?>

</tr></table>

</form>
</body>
</html>

-----------------------------------------------------------------------------------
plz help me

Edited by nav33n: Please use [code][/code] tags to wrap your code for easy readability.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by whiteyoh
0

line 91 of first file,

i may be wrong, but you need to call all the columns you need to use

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.