Re: array $_POST problem
| From: | Joey Kelly | Date: | Wed, 17 Mar 2004 16:45:18 +0000 |
| Subject: | Re: array $_POST problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180687@lists.php.net to get a copy of this message | ||
On Tuesday 16 March 2004 12:16, thou spake:
> You're the Joey Kelly who runs the LUG in NoLA, yes?
Yes, that's me. Have you been to one of our meetings lately? We redid our
website recently: http://www.nolug.org
Thanks for saying "hi" :-)
<snip>
>
> Upon post, you need to get materials as such:
>
> $materials = &$_POST['materials'];
That looks interesting (using the "&", etc.) I'll have to look into that.
What the problem ended up being was bad syntax. I was using
$materials["quantity"][1] = $_POST[$materials]["quantity"][1];
instead of
$materials["quantity"][1] = $_POST["materials"]["quantity"][1];
...using a variable instead of a string to reference the array.
<snip>
> Personally, I'd rename your form elements to:
>
> $materials[$item][quantity]
> $materials[$item][price]
> $materials[$item][description]
>
> Chris
Excellent idea. In truth, I just picked up this project again after 1.5 years,
so I expect to find other newbie mistakes in it.
FYI, the project (WebInvoicer) is listed on my "projects" page, and I expect
to release a new version of it (I'm refactoring it completely, and it will
have the MySQL backend, etc.) in a few weeks. I'll probably post it on
freshmeat, as well.
Thanks to all who offered their suggestions :-)
--
Joey Kelly
< Minister of the Gospel | Linux Consultant >
http://joeykelly.net
"I may have invented it, but Bill made it famous."
--- David Bradley, the IBM employee that invented CTRL-ALT-DEL