Re: Multi dimensional array
From: JDS (jeffrey_at_example.invalid)
Date: 02/16/05
- Next message: JDS: "Re: How to print a multidimensional associative array?"
- Previous message: vardhansasi_at_gmail.com: "sending/receiving (handling) mails thru PHP"
- In reply to: Stefan Richter: "Re: Multi dimensional array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Feb 2005 09:48:19 -0500
On Tue, 15 Feb 2005 12:07:30 -0800, Stefan Richter wrote:
> I guessed that, but so far I didnt know how, so I thought SOME
> solution is better then none.
>
> Your example definitely helps, but there is still the main point -
>
> Your code example will result in at least 2 different arrays -
> One for the regular values, one for the amount.
>
> I set the amount to "" because it is not coming from the database.
> The database just sends the details of the articles.
>
> Then the user types in the amount he wants to order from that article.
>
> I got working code where I have the data from the database in one
> array,
> and the amount in another, but then I have to loop through them and
> have to assume that index 0 in the one array fits to index 0 in the
> other array -
> if I had all in one array, I wouldn't have that problem..
>
> Do you get what I mean?
>
> Thanks,
No, I don't get what you mean. If you mean to set the value inside the
<input> field to blank (""), then why did you put anything inside the
value? See your original post:
foreach($articleTable as $article) {
?>
<input type="text" name="article[amount]" size="2" maxlength="2"
value="<? $article[amount] ?>"></td>
}
What are you trying to do here? I only say the value is getting set to ""
because the PHP statment <? $article[amount] ?> is not doing anything!!
I still really don't get what you are trying to do. My code example does
not result in two different arrays! My example does not result in any
arrays -- it just prints out stuff. Unless you mean the naming of the
<input> tag which will result in an array being created within whatever
PHP script receives the data.
Ultimately I think you have to rethink your problem a little, and learn
how to create and use multi-dimensional arrays. Hint: Use two for() or
foreach() loops -- one inside the other!
I am trying to be helpful, really, and not trying to be a prick. But I
simply do not see what you are trying to do.
later...
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
- Next message: JDS: "Re: How to print a multidimensional associative array?"
- Previous message: vardhansasi_at_gmail.com: "sending/receiving (handling) mails thru PHP"
- In reply to: Stefan Richter: "Re: Multi dimensional array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|