Page 1 of 1

Combining and comparing textboxes

Posted: Tue Jul 06, 2010 9:49 am
by marrithl2
I have a form that I am creating that has multiple text boxes. Essentially there are three types of textboxes in the form:

1) Pool: These are lists of product names and quantities (can by any number of these boxes as they are dynamically added and removed by the user)
2) Total: This textbox totals all of the product names and quantities in the Pool.
3) To Do: This textbox contains a "to do list" of changes that need to be made overall in the Pool.

I have everything displaying properly and pulling data from my database, but I cannot get the Total and To Do textboxes to operate properly when the user hits a refresh button. Below is my first attempt at making sense of this problem. I am having a lot of difficulty figuring this out and any suggestions would be greatly appreciated.

Code: Select all

<?php
include("include/session.php");

$productQty = explode("\n", $_REQUEST['productQty']);
$productList1 = explode("\n", $_REQUEST['productList1']);
$productList2 = explode("\n", $_REQUEST['productList2']);

$everything = array();
$everything = $productList1;

$numLoads = 2;
function addCommon()
{
	$result = array_intersect($productList2, $everything);
	print_r(array_keys($result, "blue"));
}
for($i = 2; $i <= $numLoads; $i++)
{
	addCommon(); 
	addDiff();
}
?>
Monitoring.jpg
Monitoring.jpg (65.86 KiB) Viewed 58 times
Pool.jpg
Pool.jpg (42.5 KiB) Viewed 58 times

Re: Combining and comparing textboxes

Posted: Tue Jul 06, 2010 10:41 am
by Jade
Text boxes are meant for large quantities of text, not so much lists of data and numbers. If you continue down this path you're going to need to do a lot of data cleaning/error checking (ie someone entering spaces instead of carriage returns). The first thing I would do is re-think how you're trying to accomplish this task by using more appropriate form input fields.