|
Posted by Neil on 10/13/23 11:28
"JDS" <jeffrey@example.invalid> wrote in message
news:pan.2005.10.03.17.53.27.906660@example.invalid...
> On Sat, 01 Oct 2005 17:04:54 -0500, Neil wrote:
>
> > I'm trying to assign values from an array to variables within my PHP
script,
> > but just can't get the syntax right.
>
> I think you are making things more complicated than they need to be.
> Actually, I know you are. Its okay, though, you gotta go through it.
>
> Instead of assigning the values from an array, just use them directly. In
> your example/question, where is the array $arrayname? Where were you
> planning on using the 'list($a, $b, $c) = $arrayname' construct?
>
> In any case, the values you are posting get put into the following places
> in your receiving PHP script:
>
> $_POST
> and
> $_REQUEST
>
> Unless you have a specific reason to do so (and there can be several) use
> $_REQUEST. It is a superset of $_GET and $_POST.
>
> So no need for the if($_SERVER['REQUEST_METHOD'] == "POST"){} block; just
> use $_REQUEST.
>
> Also, if you are just getting the name-value pairs and not doing anything
> fancy, you can skip the whole foreach() loop and use print_r() instead:
>
> $msg = print_r($_REQUEST, true);
>
> That will produce nearly the same output as your foreach() loop.
>
> But back to your original question, I don't know how to really answer it
> because you don't really show where you are going to be using the
> list()=$arrayname thing.
>
> --
> JDS | jeffrey@example.invalid
> | http://www.newtnotes.com
> DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
>
I resolved it!
I Just referred to pre-existing variables from within the PHP.
I used them to place values in a query string of a referral URL.
Thanks for your replies...
[Back to original message]
|