Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-12-19 12:11:06

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

A little gps() question

Hi at all.

I have this page

<html>
<head></head>
<body>
<txp:php>
$post=gps('obj');
print_r($post);
</txp:php>
<form method="post">
<p>Association<input type="text" name="obj[ass]" />
Address <input type="text" name="obj[adr]" />
City <input type="text" name="obj[city]" /></p>
<p>First user <br />
First Name <input type="text" name="obj[usr][1][first]" />
Second Name <input type="text" name="obj[usr][1][second]" />
Age <input type="text" name="obj[usr][1][age]" /></p>
<p>Second user <br />
First Name <input type="text" name="obj[usr][2][first]" />
Second Name <input type="text" name="obj[usr][2][second]" />
Age <input type="text" name="obj[usr][2][age]" /></p><input type="SUBMIT" name="save" value="Iniva" />
</form>
</body>
</html>

If I execute this page on my local host i read all array():

Array ( 
  [ass] => VSP
  [adr] => via tal dei tali
  [city] => Como
  [usr] => Array (
    [1] => Array (
      [first] => Pippo
      [second] => Pippetta
      [age] => 10
    )
    [2] => Array (
      [first] => Pluto
      [second] => Pippetta
      [age] => 13
    )
  )
)

If I execute this page on online web server i obtain this output:

Array (
  [ass] => Vsp
  [adr] => via tal dei tali
  [city] => Como
  [usr] => Array
)

For you, what is the trouble?

Last edited by ruud (2011-12-19 12:32:56)

Offline

#2 2011-12-19 12:22:30

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,536
Website GitHub Twitter

Re: A little gps() question

Hi

why not use adi_gps plugin that turn post and get variable into textpattern variable? is easiest no? (dont forget to add html=1” to adi_gps as a security option)

Cheers

Offline

#3 2011-12-19 12:37:13

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: A little gps() question

What happens if you do print_r($_POST);?

Is there a difference in PHP versions or configuration between your local setup and the other webserver?

Offline

#4 2011-12-19 13:52:50

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: A little gps() question

Dragondz. Why use adi_gps in ther is an internal function?

Ruud If I print print_r($_POST); I obtain a correct array data!

Array ( 
  [ass] => VSP
  [adr] => via tal dei tali
  [city] => Como
  [usr] => Array (
    [1] => Array (
      [first] => Pippo
      [second] => Pippetta
      [age] => 10
    )
    [2] => Array (
      [first] => Pluto
      [second] => Pippetta
      [age] => 13
    )
  )
)

On my local host I have PHP Version 5.3.3-1 on webserver PHP Version 5.2.6-1.
About php configuratio I don’t know difference..

Last edited by MarcoK (2011-12-19 13:54:05)

Offline

#5 2011-12-19 14:45:48

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: A little gps() question

Although I can’t find anything about this in the PHP changelogs, I suspect it’s related to differences in how the function “array_map” works in the PHP version on your webserver (compared to your local install).

You may want to submit this as a bug (in TXP) and suggest the use of “array_walk_recursive” instead of “array_map”… and/or (and this is probably good idea anyway) upgrade the PHP version on the webserver.

Last edited by ruud (2011-12-19 14:48:28)

Offline

#6 2011-12-21 08:29:12

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: A little gps() question

thanks

Offline

Board footer

Powered by FluxBB