because its being sent as an array.. php cannot directly read javascript 
arrays and as such you have to json encode/decode it


Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- 
From: "geoffcox" <[email protected]>
To: "Prototype & script.aculo.us" <[email protected]>
Sent: Sunday, July 26, 2009 5:22 PM
Subject: [Proto-Scripty] what causes this? prototype/javascript/php ?!


>
> Hello,
>
> I am not clear where the problem is with this situation.
>
> The html/javascript used Ajax.Updater to send data to a php file which
> inserts the data into mysql.
>
> Oddly, to me ay any rate, print_r($_POST) and echo give different
> results with chrome/safari and firefox.
>
> With firefox I get the extra empty element and would like to know why.
>
> Cheers,
>
> Geoff
>
> 1. with chrome/safari I get
>
> (a) print_r($_POST) gives
>
> Array ( [firstnum] => 1 [lastnum] => 3 [groupname] => test [usercode]
> => A1 [mysql_p11] => 10 [mysql_p12] => 20 [mysql_p13] => 30 [_] => )
>
> (b) echo gives
>
> 'test',
> 'test','A1',
> 'test','A1','10',
> 'test','A1','10','20',
> 'test','A1','10','20','30',
> 'test','A1','10','20','30','',
>
> 2. with Firefox/IE the [_] => and the '', are not present.
>
> 3. The Javascript code
>
> <script type="text/javascript">
>
> var startValue = 1;
> var endValue = 3;
> var p1 = [];
> var group = "test";
> var code_given = "A1";
>
> var params = {};
>
> params["firstnum"] = startValue;
> params["lastnum"] = endValue;
> params["groupname"] = group;
> params["usercode"] = code_given;
>
> p1[1] = 10;
> p1[2] = 20;
> p1[3] = 30;
>
> for (i=startValue;i<(endValue+1);i++) {
> params["mysql_p1" + i] = p1[i];
> }
>
>     new Ajax.Updater(
>        'updateDiv',
>        'fv-p1-arrays4-mysql-test.php',
>        {
>            asynchronous:true,
>            method:'post',
>            parameters: params
>        }
>    );
>
> </script>
> >
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to