Floyd,
I thought about this some and started noodling out a solution for you, but
have a few questions before I go any farther on this.
1. The part about users inputting their own column headers is relatively
straight forward.  Something like this should work:

<?php
if (!isset($start_button))
    {
    print "<form action=$PHP_SELF method=get>";
    print "Input the following information";
 // these are your fixed cells
    print "Name: <input type=text name=name size=20><br>";
    print "Temp: <input type=text name=temp size=20><br>";
    print "Time: <input type=text name=time size=20><br>";
    print "Offset: <input type=text name=offset size=20><br>";
 // User inputs the number of additional cells needed
  print "Input number of additional cells needed: <input type=text
name=additional_cells size=20><br>";
  print "<input type=hidden name=start_button value=1>";
  print "<input type=submit value=\" Hit it! \">";
  print "</form>";
  }
if ($start_button=="1")
 {
 print "<form action=$PHP_SELF method=get>";
 print "Input the following information";
 // these are your fixed cells and they now contain user input
   print "Name: <input type=text name=name value=\"$name\" size=20><br>";
   print "Temp: <input type=text name=temp value=\"$temp\" size=20><br>";
   print "Time: <input type=text name=time value=\"$time\" size=20><br>";
   print "Offset: <input type=text name=offset value=\$offset\"
size=20><br>";
 print "Input the names of the desired additional cells in the spaces
provided.";
 // this is where your user will name the cells he asked to create
 for($i=1;$i<=$additional_cells;$i++)
  {
  print "$i <input type=text name=user_added[$i] size=20><br>";
  }
 print "<input type=hidden name=additional_cells value=\"$additional_cells\"
>";
 print "<input type=hidden name=start_button value=2>";
 print "<input type=submit value=\" Hit it! \">";
 print "</form>";
 }
if ($start_button=="2")
   {
    print $name."<br>".$temp."<br>".$time."<br>".$offset."<br>";
    for($i=1;$i<=$additional_cells;$i++)
    {
    print "user cell ".$i." ".$user_added[$i]."<br>";
    }
}
?>


2. Now comes the tricky part, and the part I'm unsure about.  You can
convert the user input in the above so that it becomes the names of the
input cells, or you can leave them in a numeric array.  Leaving them in a
numeric array will be easier to deal with later.
Also, other than the display of a table, what do you want the user input
for?  If you're planning on doing any data manipulation, then your coding
will get a bit hairy because you won't know what relation the user input
data has to your standard data (name, time, temp and offset).  Finally, if
you're planning on storing the data in a database table, each table will
need to be created on the fly--it can be done, but if you're struggling with
this, it'll take you some time to get the back end working.

Hope this helps,
Hugh

----- Original Message -----
From: "Floyd Baker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'Hugh Danaher'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 5:24 PM
Subject: Re: [PHP] dynamic arraynames


>
>
> Well I might be in the wrong place.  I've also asked in the HTML list
> now too but I'm still stuck and need some help.
>
> This is pretty much as clear as I can make it.  I'm up against a
> mental block and even if it's as clear as glass to others I'm dead in
> the water and would appreciate some pointers.  I have a bunch of
> pieces but can't seem to string them together enough to make it work.
>
> Just trying to build an x-y array of data input fields and then send
> them recursive to be used further down the program.
>
> I can do this fine with a fixed number of columns and rows of user
> input but I cannot figure out how to make this happen using a variable
> number of columns.  I'm a complete array amateur and would appreciate
> a little assistance...
>
> I want it to look something like this:
>
> Name          Temp      Time      Offset    Etc.      As needed...
> process 1    [input]   [input]   [input]   [input]   [inputs]
> process 2    [input]   [input]   [input]   [input]   [inputs]
> process 3    [input]   [input]   [input]   [input]   [inputs]
> process 4    [input]   [input]   [input]   [input]   [inputs]
>
> Right now, for the three *basic* columns, I have the lines below in a
> 'while' loop.
>
> <INPUT TYPE='text' NAME='temp[]' VALUE='$temp' SIZE='10'
> MAXLENGTH='10'>
> <INPUT TYPE='text' NAME='time[]' VALUE='$time' SIZE='10'
> MAXLENGTH='10'>
> <INPUT TYPE='text' NAME='offs[]' VALUE='$offs' SIZE='10'
> MAXLENGTH='10'>
>
> But when it comes to adding additional columns that a user
> determines are needed, I am lost.  Users might want to add 0, or 4, or
> 10 additional items...  I would like only that number of usable
> input columns be on the input-form, identified for what they contain,
> and then be passed to the next page....
>
> Again, many thanks in advance.
>
> Floyd
>
>
>
>
>
>
> On Sun, 24 Nov 2002 23:55:56 -0500, you wrote:
>
> >I'm sorry, but I'm still confused. Can you show us a sample of the data
> >in the database and what you want the resulting form to look like for
> >that data? Maybe that'll help.
> >
> >---John Holmes...
>
>
>
>
>
> --
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to