Forum Moderators: coopster

Message Too Old, No Replies

syntax help

         

cremesoda201

4:04 pm on Jun 2, 2005 (gmt 0)

10+ Year Member



I have a form being submitted with values such as:

Rate[1]
Rate[2]
etc etc.

I'm working on the submission page. And I want to simplify the syntax for the INSERT so I'm defining $Rate and then just going to put that on the query. So if I do a test, such as:

$x = 5;
$Rate = $_POST['Rate[$x]'];

I'm not getting a value. I know it's a problem with the brackets/syntax but I'm not good with proper syntax. Could anyone guide me here? I know it just needs some quotations and " ' and such in the right spots.

cremesoda201

4:18 pm on Jun 2, 2005 (gmt 0)

10+ Year Member



Eh, maybe scratch the brackets. It looks like I was trying to do an array of some sort. But even if i lose the [] on the inside, I still get no value.

jatar_k

4:42 pm on Jun 2, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try it this way

Rate is an array within the POST array so ....

$x = 5;
$Rate = $_POST['Rate'][$x];

cremesoda201

9:18 pm on Jun 2, 2005 (gmt 0)

10+ Year Member



Ah I figured it out.

New: $NewRate = $Rate[$x];

$Rate = $Rate[$x]; was bombing out the array.