keyongtech


  keyongtech > php > 03/2007

 #1  
03-20-07, 10:00 PM
phpCodeHead
I know that this sounds like something overly complex - because it is.
However, if I can keep the user interface the way it is, my users will
be ultra happy! That is the goal...

In general, this is an inventory receiving piece of an overall larger
web-based ERP system.

What I have is a form in which I have a dynamic number of multline
textareas for inputting (possibly barcode scanning in) many serial
numbers per lineitem recieved.

For example:
lineitem01 = widget01; qtyReceived = 2;
lineitem02 = widget02; qtyReceived = 3;
lineitem03 = widget03; qtyReceived = 10;

This would display a form that will generate 3 textarea elements (1
per lineitem received). Inside each textarea element will be input the
serial numbers for each of the widgets received per lineitem. i.e. 2
serial numbers will be entered for widget01; 3 for widget02; and 10
for widget03;

So, what I am trying to do is pass this data over, possibly as a multi-
dimensional array to another form ( or possibly
$_SERVER['PHP_SELF'] ) to update a MySQL database to store the widget/
serial numbers.

Any ideas at all on how to approach this problem are welcomed.

Thanks.
 #2  
03-20-07, 11:23 PM
Jeff
On Mar 20, 3:00 pm, "phpCodeHead" <phpcodeh> wrote:
[..]
> for widget03;
>
> So, what I am trying to do is pass this data over, possibly as a multi-
> dimensional array to another form ( or possibly
> $_SERVER['PHP_SELF'] ) to update a MySQL database to store the widget/
> serial numbers.
>
> Any ideas at all on how to approach this problem are welcomed.
>
> Thanks.


If you display the form like this:

<input type=hidden name=lineitems[] value="widget01">
<textarea name="widget01"></textarea>
<br><br>
<input type=hidden name=lineitems[] value="widget02">
<textarea name="widget02"></textarea>
<br><br>
<input type=hidden name=lineitems[] value="widget03">
<textarea name="widget03"></textarea>

Then when you post the data you can loop through the lineitems array
and get the entry for each textarea by using the value of the lineitem
like so:

foreach ($_POST['lineitems'] as $lineitem) {
$serial_text = $_POST[$lineitem];
$serials = explode("\n", $$serial_text);

// do whatever you need to do with each element serial for this
widget
// you also would want to trim() each item in the $serials array
before using it in case it has a left over \r in it
}

Hope this is answering the right question you had.
Similar Threads
writing multi dimensional array of data to text file

does anyone have any suggestions for writing a two dimensional array of data to a file. Currently, I have an array of 5 columns, with 1000 elements per array. I know that I...

flatten multi-dimensional array to on-dimensional array

Hi all, I have a two-dimensional array of data, f.x int's. We can imagine that the array is "really large". Now I want the data in it and store this in a one-dimensional...

Multi-dimensional Array

Hi, I am totally confused with the concept of arrays in CPP. Is a 3D Char array equivalent to a 2D String array? Thanks and Regards, M Shetty

Multi-dimensional array - Question on Data types

Hello: Is is possible to declare a 2-dimensional array, the first dimension being an Integer and the 2nd dimension another data type, say string? Or, is this a bad choice...

multi sorting multi dimensional array?

Hey all, I have been using usort to sort my multi dimensional arrays ... function cmp($a, $b){ if($a[0] == $b[0]){ return 0; } return ($a[0] < $b[0]) ? -1 : 1; }


All times are GMT. The time now is 04:19 PM. | Privacy Policy