Re: Array questions...
| From: | Jason Pruim | Date: | Wed, 05 Mar 2008 15:34:07 +0000 |
| Subject: | Re: Array questions... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271019@lists.php.net to get a copy of this message | ||
Okay so I'm replying to my own post... And top posting to boot! :P
Amazing what happens when you pull a few [] off.... for completness:
$NumArray = Array($_POST['txtNumArray']);
works as I wanted :) Anyone have any texts that could help me get a better grasp on arrays though? :)
On Mar 5, 2008, at 10:28 AM, Jason Pruim wrote:
So for some reason, arrays always mess me up... I don't know what it is, but it just hasn't clicked yet... So I'm sure this is a simple question for someone who knows and understands arrays :) So with that being said here's the code I'm using: $self = $_SERVER['PHP_SELF']; $i="0"; if (isset($_GET['txtNum'])) { $numBox= $_GET['txtNum']; $_SESSION['num'] = $_GET['txtNum']; }else{ $numBox = $_SESSION['num']; } echo "store box variable". $_SESSION['num']; echo <<<HTML <form method="GET"> How many boxes? <input type="text" size="2" name="txtNum"> <BR> <input type="submit"></form> HTML; $NumArray= Array($_POST['txtNumArray[]']); echo <<<TABLE <P>Weight of 100 pieces: <input type="text" size="5" name="txtPieceWeight"></P> <table border="1"><tr><th>Route #</th><th>Pieces in route</th><th>Weight of route</th></tr> TABLE; echo "<form method=\"POST\" action=\"$self\">"; while($i < $numBox){ echo <<<HTML <tr> <td> <input type="text" size="5" name="txtNumArray[]" value="txtNumArray[$i]"> </td> <td> <input type="text" size="5" name="txtPiecesArray[]" value="txtPiecesArray[$i]"> </td> <td> <input type="text" size="5" name="txtWeightArray[]" value="txtWeightArray[$i]"> </td> </tr> HTML; $i++; } echo "<input type=\"submit\"></form>"; What I'm attempting to do, is grab the info out of txtNumArray[] and put it into the variable $numArray Sounds easy enough right? Well I've tried using $NumArray = Array($_POST['txtNumArray[]'); but that's not working... I've tried $NumArray = $_POST['txtNumArray[]']; which didn't work... and I've looked on the php manual, but they all assume you understand this stuff which I do not :) Anyone know what I'm doing wrong? Or could at least point me to some text like "Array's for Dummies"? :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.com-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.com