Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   I could use some brainstorming (http://www.programmingforums.org/showthread.php?t=12214)

grimpirate Dec 19th, 2006 2:19 AM

I could use some brainstorming
 
I'm simplifying the actual problem in the hopes that it will make the idea more efficient.
This is the array setup:
:

$foo[0] = 'something';
$bar[0][0] = 'something else';
$sna[0][0] = 'something more';
$bar[0][1] = 'another else';
$sna[0][1] = 'another more';
$foo[1] = 'more somethings';
$bar[1][0] = 'somethings elses';
$sna[1][0] = 'somethings mores';
...

The pattern continues like that of nth size and there must always be at least one $sna or $bar that starts with the same index as that of the $foo array.
So my question is how would I design a frontend HTML interface that would allow me to do the following:
  • change array positioning
  • modify array values
  • add more values to the arrays
Any ideas about the visual layout would be very helpful thank you.

Shaffer Jan 21st, 2007 12:12 PM

Arrays aren't dynamic enough for that.
You can't just add Array parameters.

DaWei Jan 21st, 2007 1:18 PM

Excuse me, Shaffer? Please don't post misleading information. PHP arrays are indeed dynamic.
:

<?php
$mainArray = array ();
?>
<!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>Array Growth</title>
</head>
<body>
<?php
echo "mainArray<br/>";
print_r ($mainArray);
echo "<br/>";
$elemOne = array ("Element One");
$elemTwo = array ("Element Two");
$elemOne [] = "Element OneTwo";
$elemTwo [] = "Elent TwoTwo";
$mainArray [] = $elemOne;
$mainArray [] = $elemTwo;
echo "mainArray grown<br/>";
print_r ($mainArray);
echo "<br/>";
?>
</body>
</html>

Quote:

Originally Posted by Output
mainArray
Array ( )
mainArray grown
Array ( [0] => Array ( [0] => Element One [1] => Element OneTwo ) [1] => Array ( [0] => Element Two [1] => Elent TwoTwo ) )


grimpirate Jan 21st, 2007 9:13 PM

1 Attachment(s)
I actually figured out a way to do it sorry that I hadn't replied to this thread but I'd forgotten that I actually started it when I got involved in the solution. Here's a pic to illustrate the idea.


All times are GMT -5. The time now is 1:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC