Re: [PHP] Arrays and Forms

2002-05-19 Thread Miguel Cruz

Your code looks fine. Are you sure you haven't edited away significant 
parts of it when posting to the list? Maybe a  
somewhere?

miguel

On Sun, 19 May 2002, Navid Y. wrote:
> I'm having trouble sending array values through forms.
> Will the following syntax create a variable called $product['desc'] on
> the next page?
> If not, what am I doing wrong here?
> 
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.
> 
> 
> menu_add.php
> -
> 
> 
> 
> 
> 
> menu_list.php
> -
> echo $product['desc'];
> 
> 
> Result output
> -
> no output
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Arrays and Forms

2002-05-19 Thread Jason Wong

On Monday 20 May 2002 07:05, Navid Y. wrote:
> Hello Everyone,
>
> I'm having trouble sending array values through forms.
> Will the following syntax create a variable called $product['desc'] on
> the next page?
> If not, what am I doing wrong here?
>
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.

I don't see anything wrong with the code below. You're saying ...

   

   and

   echo $product;

... works (on the same server without any other changes)?


> menu_add.php
> -
> 
> 
> 
>
>
> menu_list.php
> -
> echo $product['desc'];
>
>
> Result output
> -
> no output

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality.
-- Albert Einstein
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Arrays and Forms

2002-05-19 Thread Jason Morehouse

Try:





On Mon, 20 May 2002 11:05:07 +1200, Navid Y. wrote:

> Hello Everyone,
> 
> I'm having trouble sending array values through forms. Will the
> following syntax create a variable called $product['desc'] on the next
> page?
> If not, what am I doing wrong here?
> 
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.
> 
> 
> menu_add.php
> -
>   name="product[desc]"> 
> 
> 
> menu_list.php
> -
> echo $product['desc'];
> 
> 
> Result output
> -
> no output
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 Linux: because rebooting is for adding hardware

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Arrays and Forms

2002-05-19 Thread Navid Y.

Hello Everyone,

I'm having trouble sending array values through forms.
Will the following syntax create a variable called $product['desc'] on
the next page?
If not, what am I doing wrong here?

Note: I tried this but it didn't work! When I tried doing it without
using an array, but rather with a regular variable, it sent through just
fine and created a variable of the name attribute in the input tag.


menu_add.php
-





menu_list.php
-
echo $product['desc'];


Result output
-
no output


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Arrays and forms

2001-02-18 Thread Jamie Smith

Thanks to all the replies to my previous email on arrays (passing arrays through URLs) 
but I cannot seem to get serialize() to work correctly so I'm now trying to echo out 
the array as a series of hidden elements in a form that when submitted will re-build 
the array.
I've been driving myself mad with this problem for some time now an I hope that 
someone can help me with this.
 I'm trying to insert into a table called options an option_type (eg shape), an 
option_value (eg square) and product_code (a six digit code).
 I want this table to be filled from a web form with check boxes (which are called 
from the same table with a code of XXX so that I know they are possible options for 
any product).
I can do this and have got the code below generated

Colour
 Red
 Violet
 Green


 Blue

Size
 A3
 A4
 A5


>From the options table that looks like this:
type - value - code
colour - red - XXX
colour - blue - XXX
colour - violet - XXX
colour - geen - XXX
size - A3 - XXX
size - A4 - XXX
size - A5 - XXX

I think this html form code  is right so that when the form is submitted the an array 
$form_options will be generated
now here is my problem:
I don't know how to output the array to a html  fields so that I 
can safly pass the array form page to page or so that I can then do inserts into the 
database 
here is as close as I have gotten :

foreach ($form_options as $arrayType){
   $i++;
   $type = ($arrayType[$i]);
foreach ($arrayType as $value){
  echo("Option :". $type ." Value :". $value . "");
  }
 
but this code only produces :
Option :Red Value :Red
Option :Red Value :Violet
Option :Red Value :Green
Option :Red Value :Blue
Option :A4 Value :A3
Option :A4 Value :A4
Option :A4 Value :A5

I can't seem to find the 'Type' value that should be in the array.

Can anyone help me with this code as I DESPERATLY need it.

Thanks again  
Jamie

PS sorry for the long winded explaination but I hope I was clear enough in what my 
aims are.