PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
problem with $_POST (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: problem with $_POST
#321
mikeeco (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
problem with $_POST 1 Month, 4 Weeks ago Karma: 0  
I am using DirectPHP to include a pph script that uses $_POST to process a form initiated in some Joomla content. If I use form action directly with the php script it works fine. If I use the include in some content using directPHP the variables are not being passed by the POST. I have echoed the variables and they are blank if I use the include.
Is there any reason that $_POST would not work in the include in some Joomla content, but does work directly?

Thanks,
Mike
 
  The administrator has disabled public write access.
#322
kksou (Admin)
Admin
Posts: 232
graph
User Online Now Click here to see the profile of this user
Re:problem with $_POST 1 Month, 4 Weeks ago Karma: 7  
Hi Mike,

$_POST is a global variable. It should work.

Could you try adding the following:

<php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>

to the very first line of your content item.

Did you see anything?

Regards,
/kksou
 
  The administrator has disabled public write access.
#324
mikeeco (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
Re:problem with $_POST 1 Month, 4 Weeks ago Karma: 0  
Thanks for the quick response. I tried the suggestion above and recieved they following output:

Code:
Array
(
)
 
_POST variables are inherently global, correct? I have done the same include using jumi and the POST variables are passed fine. Thanks again for your help. Mike
 
  The administrator has disabled public write access.
#325
kksou (Admin)
Admin
Posts: 232
graph
User Online Now Click here to see the profile of this user
Re:problem with $_POST 1 Month, 4 Weeks ago Karma: 7  
Hi Mike,

Why don't you try adding the jumi code right after the code I've given above. (Please use exactly the same content item.)

I think you're get the same empty array for $_POST using jumi.

DirectPHP, just like jumi, is just a straightforward eval(). So if you see the empty array, it simply means there's nothing in the $_POST.

You might want to check the original form that passes the data over.

Alternatively, you could try the following:
1) Change the original form from POST to GET.

2) Fill in the form and click the submit button.

3) Check the URL of the content item processing the form. Do you see all the GET variables in the URL?

4) Now in the DirectPHP, change print_r($_POST) to print_r($_GET). Do you see all the $_GET variables in the array?

If $_GET is working fine, you can try changing GET back to POST and see if it works.

If this still doesn't work, let me know. I will give you another way of debugging.

Regards,
/kksou
 
 
Last Edit: 2008/06/23 15:32 By kksou.
  The administrator has disabled public write access.
#326
mikeeco (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
Re:problem with $_POST 1 Month, 4 Weeks ago Karma: 0  
Thanks for your help. I figured out my problems with your last suggestions.

I was using the entire url in the include which was causing problems. When I used the same path I used in jumi it was fine. I thought I had done this earlier and had an error that the script could not be found. I must have had a typo.

I like that DirectPHP allows me to put snipets of code right in the content. Jumi was only allowing me to include scripts that already had to be on the server, which was creating lots of little pieces of code.

Thanks for a great pluggin.

Mike
 
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Copyright © 2006-2008. kksou.com. All Rights Reserved