[PHP] $_POST to function?

2006-02-24 Thread Jason Gerfen
I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.


return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
 echo pre; print_r( $args ); echo /pre;
}

--
Jason Gerfen

When asked what love is:
Love is the Jager talking.
~Craig Baldo

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



RE: [PHP] $_POST to function?

2006-02-24 Thread Dan Parry
Why are you passing the POST array?  As it's superglobal why not just work
directly on it within the function?

Dan

-
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: 24 February 2006 15:27
To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.

return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
  echo pre; print_r( $args ); echo /pre;
 }

-- 
Jason Gerfen

When asked what love is:
 Love is the Jager talking.
~Craig Baldo

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

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



Re: [PHP] $_POST to function?

2006-02-24 Thread Jason Gerfen

Dan Parry wrote:


Why are you passing the POST array?  As it's superglobal why not just work
directly on it within the function?

Dan

-
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: 24 February 2006 15:27

To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.


return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
 echo pre; print_r( $args ); echo /pre;
}

 

Perhaps I should post some more of the code I am working.  I am 
attempting to create a simple method of outputing data to a template 
function which only holds html data to be displayed on the browser.  
Here is a quick overview, perhaps I cannot do this.


index.php calls this:
$data = chooser( $_SESSION['a'], $_GET['b'], $_SESSION['c'], 
$_SESSION['d'] );


Contents of chooser function:
function chooser( $level, $page, $user, $pass ) {
if( $page == global ) {
 require 'global.inc.php';
 $data = global_dhcp( $_SESSION['lvl'], $_POST['dn'], $_POST['lt'], 
$_POST['mlt'], $_POST['msc01'], $_POST['msc02'], $_POST['msc03'], 
$_POST['msc04'], $_POST['msc05'], $_POST['pxe'], $_POST['pxe01'], 
$_POST['pxe02'], $_POST['pxe03'], $_POST['pxe04'], $_POST['pxe05'], 
$_POST['pxe05'] );

}

contents of global_dhcp function:
function global_dhcp( $level, $domain, $lease, $mxlease, $msc01, $msc02, 
$msc03, $msc04, $msc05, $pxe, $pxe01, $pxe02, $pxe03, $pxe04, $pxe05, 
$pxe06 ) {

 global $defined, $error_message;
 require 'template.php';
 if( ( empty( $domain ) ) || ( empty( $lease ) ) || ( empty( $mxlease ) 
) ) {
   $db = db( $defined['dbhost'], $defined['username'], 
$defined['password'], $defined['dbname'] );

   $sql = @mysql_query( SELECT * FROM global, $db )
   $args = @mysql_fetch_array( $sql_global );
   @mysql_close( $db );
$message = message;
return global_template( 1, $args, count( $args ), $message );
logs( $error_message['valid'] );
 } else {
   return global_template( 4, NULL, NULL, NULL, NULL );
   logs( $error_message['usr_chk'] );
 }
}

and the contents of the global_template function:
function global_template( $cmd, $args, $num, $message, $errors ) {
 if( $cmd == 4 ) {
  $data = img src=\images/error.jpg\nbsp;nbsp;blinkbError: 
/b/blinkYou do not have proper access to use this utility. Your 
computer information has been recorded and the Administrator has been 
notified.;

 }
return $data;
}

So in essence:

index.php-chooser-global_dhcp-global_template-output to browser

I hope that clarifies my problem a bit.

--
Jason Gerfen

When asked what love is:
Love is the Jager talking.
~Craig Baldo

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



RE: [PHP] $_POST to function?

2006-02-24 Thread Jared Williams

 
 Why are you passing the POST array?  As it's superglobal why 
 not just work directly on it within the function?
 

Passing it has distinct advantages, like being able to test the function.

Jared

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



RE: [PHP] $_POST to function?

2006-02-24 Thread Peter Lauri
Is the function actually returning anything? Aren't you just echoing the
content of the $_POST?

-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 24, 2006 10:27 PM
To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.

return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
  echo pre; print_r( $args ); echo /pre;
 }

-- 
Jason Gerfen

When asked what love is:
 Love is the Jager talking.
~Craig Baldo

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

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



RE: [PHP] $_POST to function?

2006-02-24 Thread Peter Lauri
Do:

function global_template( $cmd, $args, $num, $message ) {
  ob_start();
  echo pre; print_r( $args ); echo /pre;
  ob_end_flush();
  return ob_get_contents();
}


-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 24, 2006 10:27 PM
To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.

return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
  echo pre; print_r( $args ); echo /pre;
 }

-- 
Jason Gerfen

When asked what love is:
 Love is the Jager talking.
~Craig Baldo

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

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



Re: [PHP] $_POST to function?

2006-02-24 Thread Jason Gerfen

Peter Lauri wrote:


Is the function actually returning anything? Aren't you just echoing the
content of the $_POST?

-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 24, 2006 10:27 PM

To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.


return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
 echo pre; print_r( $args ); echo /pre;
}

 

Well as I pass $_POST to the global_template function I am not seeing 
anything in the $args array in the global_template function.  And to 
this point I still have not figured out why.


--
Jason Gerfen

When asked what love is:
Love is the Jager talking.
~Craig Baldo

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



Re: [PHP] $_POST to function? [SOLVED]

2006-02-24 Thread Jason Gerfen

Peter Lauri wrote:


http://th.php.net/manual/en/function.return.php


-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 25, 2006 12:29 AM

To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] $_POST to function?

Peter Lauri wrote:

 


Is the function actually returning anything? Aren't you just echoing the
content of the $_POST?

-Original Message-
From: Jason Gerfen [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 24, 2006 10:27 PM

To: PHP General (E-mail)
Subject: [PHP] $_POST to function?

I am not sure why this is not working.  Aren't $_POST vars 
superglobals?  I am trying to pass the $_POST array as an argument to a 
function and nothing is being returned.  Any help is appreciated.


return global_template( 3, $_POST, count( $_POST ), $message );

function global_template( $cmd, $args, $num, $message ) {
echo pre; print_r( $args ); echo /pre;
}



   

Well as I pass $_POST to the global_template function I am not seeing 
anything in the $args array in the global_template function.  And to 
this point I still have not figured out why.


 


Figured it out, typo.  I must have fat fingers today.  Thanks everyone.

--
Jason Gerfen

When asked what love is:
Love is the Jager talking.
~Craig Baldo

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