FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » First question and introducing myself
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
First question and introducing myself [message #178012] Thu, 10 May 2012 15:18 Go to previous message
Shake is currently offline  Shake
Messages: 40
Registered: May 2012
Karma:
Member
Hi All,

That's my first post in this group. I would start introducing myself...
Hello! and apologizing if I make any mistake, writing (English is no my
natural language) or not following the rules of this group.

And now, the on topic question:

A little introduction: it's about preparing variables, taking some vars
getted by $_POST and passing to $_SESSION.

The basic idea is a function to trim(), and check some rules on this
$_POST values. And the problem to solve is walking throught a
"multidimensional array path".

An example:

I get via post:

$_POST['not']['interesting']
$_POST['yes']['interesting']['selector']
$_POST['yes']['interesting'][0]['something']
$_POST['yes']['interesting'][0]['otherthing']
$_POST['yes']['interesting'][1]['something']
$_POST['yes']['interesting'][1]['otherthing']
$_POST['other']
....

Check (for example) and set into $_SESSION the

$_POST['yes']['interesting'][0] array

And get a checked:

$_SESSION['yes']['interesting'][0]['something']
$_SESSION['yes']['interesting'][0]['otherthing']


Suposse i do:

$selector = trim($_POST['yes']['interesting']['selector'])

if( trim($_POST['yes']['interesting'][$selector]['otherthing'])==''
|| othercheck
) {
$the_data =
trim($_POST['yes']['interesting'][$selector]['otherthing']);
// do more things $the_ data
$_SESSION['yes']['interesting'][$selector]['otherthing'] = $the_data;

}

And I repeat this kind of if segment a few times... And I want to
convert it to a method or function...

What I really want to do (And I don't found how to do) is something like:

(This is some... php pseudocode)

public function checkPostData( $array_path)
{
if(trim($_POST[ the $array_path ] )) do somethin.
}

and call by: checkPostData(['yes']['interesting']['selector']);

Thats its not posible, of course...

then I though passing by reference...

public function checkPostData( & $item) {

// Get the parents indexs until arrive to $_POST

}

But I don't get any result in my "investigation". Then I though that
anybody have to found this requiremente before... and tried to search on
the web... But I don't get the answers, probably because I don't know
the best words to search for.

And that's all.

Sorry for the long of the text, and thanks for all.

Bye
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Windows binaries 64bit for PHP
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 05:42:20 GMT 2024

Total time taken to generate the page: 0.04309 seconds