Hi, I have a php page to take user input. My page has 3 sections.
Section 1:: I am taking some information from the user.
Section 2:: I am again taking some input from the user, and
Section 3:: I am displaying the data from section 2, in a table.

Now I would like to submit this data to another php page for database operation.
I am able to submit the data from section 1, but I am unable to submit the data stored in section 3.

Here is my code

<!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" xml:lang="en">

<head>

<title>Billing & Inventory Management System ver 2.0 PURCHASE</title>

<meta name="Keywords" content="" />

<meta name="Description" content="" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta http-equiv="Content-Language" content="en-ie" />

<meta name="robots" content="all" />

<meta name="MSSmartTagsPreventParsing" content="true" />

<meta http-equiv="imagetoolbar" content="no" />

<meta name="copyright" content="Copyright (c) 2011 Anirban Ghosh" />

<meta name="author" content="" />

<meta name="Rating" content="General" />

<link rel="shortcut icon" href="" type="image/x-icon" />

<link rel="stylesheet" type="text/css" media="all" href="css/glob_nav.css" />

<link rel="stylesheet" type="text/css" media="all" href="css/template.css" />

<script language="javascript" type="text/javascript" src="js/datetimepicker.js"></script>

<script language="JavaScript" type="text/javascript">

function showtotal()

{

var total=0;

total+=this.value;

alert(total);

}

        function addRow(tableID,form) 

        {

            var table = document.getElementById(tableID);

            var rowCount = table.rows.length;

            var row = table.insertRow(rowCount);



 	    Item = form.select_itm.selectedIndex;

	    Result = form.select_itm.options[Item].text;



		var qt=form.qty1.value;

		var rt=form.pp.value;

		var qtrt=qt*rt;



            var cell1 = row.insertCell(0);

            var element1 = document.createElement("input");

            element1.type = "checkbox";

            cell1.appendChild(element1);

 

            var cell2 = row.insertCell(1);

            cell2.innerHTML = rowCount ;

 

            var cell3 = row.insertCell(2);

            var element2 = document.createElement("input");

            element2.type = "text";

            cell3.appendChild(element2);

            cell3.innerHTML = Result;



            var cell4 = row.insertCell(3);

            var element3 = document.createElement("input");

            element3.type = "text";

            cell4.appendChild(element3);

	    cell4.innerHTML = form.qty1.value;

	    

            var cell5 = row.insertCell(4);

            var element4 = document.createElement("input");

            element4.type = "text";

            cell5.appendChild(element4);

	    cell5.innerHTML = form.pp.value;

	    

            var cell6 = row.insertCell(5);

            var element5 = document.createElement("input");

            element5.type = "text";

            cell6.appendChild(element5);

	    cell6.innerHTML = form.sti.value;



            var cell7 = row.insertCell(6);

            var element6 = document.createElement("input");

            element6.type = "text";

            cell7.appendChild(element6);

	    cell7.innerHTML = form.mrp.value;

	    

            var cell8 = row.insertCell(7);

            var element7 = document.createElement("input");

            element7.type = "text";

            cell8.appendChild(element7);

 	    cell8.innerHTML = qtrt;

        }

 

function deleteRow(tableID) {

            try {

            var table = document.getElementById(tableID);

            var rowCount = table.rows.length;

 

            for(var i=0; i<rowCount; i++) {

                var row = table.rows[i];

                var chkbox = row.cells[0].childNodes[0];

                if(null != chkbox && true == chkbox.checked) {

                    table.deleteRow(i);

                    rowCount--;

                    i--;

                }

            }

            }catch(e) {

                alert(e);

            }

        }

    </script>

</head>





<body bgcolor="#f0f0f0">

<div id="header">

<?php

include('login_top.php');

?>

</div>

<?php

include('menu.php');

?>



<div id="body">

<div id="container">

<h1 align="center">PURCHASE FORM</h1>

<form id="pform" name="pform" method="post" action="purchase_process.php">

Supplier Name

<select name="select_sup" size="1">

					<option value="select" selected="selected">Select</option>

					<?php 

	include ('db_connect.php');

    

	$sql = "SELECT supp_name FROM suppliers ORDER BY supp_name;";

	$rs=mysql_query($sql);

	$count = @mysql_num_rows($rs);

	if($count > 0)

	$i=0;

	while ($i < $count) {

	$supp_name=mysql_result($rs,$i,"supp_name");

	

	?>

					<option ><?php echo $supp_name; ?></option>

<?php

$i++;

}

echo "</select>";

?>Bill No

<input name="bn" id="bn" type="text"  />



Bill Date

<td width="18%"><input id="date" type="text" name="date" size="25"><a href="javascript:NewCal('date','ddmmyyyy')"><img src="js/cal.gif" width="22" height="22" border="0" alt="Pick a date"></a></td>

		<td width="22%" style="">



Bill Total (Rs.)

<input name="bt" id="bt" type="text" readonly="readonly" />



<table id="inputTable" width="100%" border="1" cellspacing="0" cellpadding="1">

<tr>

<td width="150">Item</td>

<td width="50">Quantity</td>

<td width="50">PP (Rs.)</td>

<td width="50">STI (Rs.)</td>

<td width="50">MRP (Rs.)</td>

</tr>



<tr>

<td>

	<select name="select_itm" size="1">

		<option value="select" selected="selected">Select</option>

		<?php include ('db_connect.php');

    		$sql = "SELECT item_name FROM item ORDER BY item_name;";

		$rs=mysql_query($sql);

		$count = @mysql_num_rows($rs);

		if($count > 0)

			$i=0;

			while ($i < $count)

			 {

				$item_name=mysql_result($rs,$i,"item_name");

		?>

			<option ><?php echo $item_name; ?></option>

		<?php

				$i++;

			}

			echo "</select>";

		?>

</td>

<td>

	<input name="qty1" id="qty1" type="text" onChange=window.open("sl_sl_rd.php","Ratting","width=550,height=170,left=150,top=200,toolbar=1,status=1,this") >

</td>

<td>

	<input name="pp" id="pp" type="text" onChange="show_alert(this)" >

</td>

<td>

	<input name="sti" id="sti" type="text" onkeyup="integeronly(this)" >

</td>

<td>

	<input name="mrp" id="mrp" type="text"  >

</td>

  <td>

    <input name="add"  value="Add" id="add" onClick="addRow('dataTable',this.form)" type="button">

    <input name="cancel"  value="Cancel" id="cancel" onClick="reset()" type="button">

  </td>

</tr>

</table>

 

<table id="dataTable" border="1" cellspacing="0" cellpadding="1">

<tr>

<td width="50">Select</td>

<td width="50">SL. No.</td>

<td width="150">Item</td>

<td width="15">Quantity</td>

<td width="25">PP</td>

<td width="25">STI</td>

<td width="25">MRP</td>

<td width="25">Amount</td>

</tr>



</table>

<table>

<tr>

<td width="25"><input type="button" id="submit" value="Submit" name="LOGIN_SUBMIT"/></td>

<td><INPUT type="button" id="delete" value="Delete Item" onclick="deleteRow('dataTable')" /></td>

</tr>

</table>

</form>

<br class="clearfloat" /
<div id="footer">

<p></p>

</div>

</body></html>

Who to get the data from this page to the next page?

The data in the form will be passed to your purchase-process program. If you have any additional fields that you need to pass to that program then define them as hidden variables in the form (<input type=hidden...) and set the value and name.

The data in Section is passed to the purchase-process program, but the data from section 3 is not going any where. I am stuck on that particular section.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.