PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old July 24th, 2002, 12:58 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
advanced forms in included php

I am doing a site which has a popup object which creates a popup window, fully db driven, using sub objects.

anyway I then want to include a chunk of html/php which includes a form.

no problem, but when submitted to the same page I can;t pull the info from $_POST

it allows me to pull this info in the object which includes the form file. (the line before the include) but as soon as that include is added, the very first line can't read the data. (I know the tags are fine)

BUT I recreated the set up as best I could, I made a page which created a popup then read the main body into the popup and then added the include (THE SAME FILE AS USED BEFORE) and it works flawlessly.

But I know the php is not getting lost in the objects or anything because like I said it can be read the line before the include.

What is the deal with that?

Please help, this is very frustrating.

Reply With Quote
  #2  
Old July 24th, 2002, 08:55 AM
greggory greggory is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Reims, France
Posts: 82 greggory User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: advanced forms in included php

Can U give us a chunk of code so we can understand a little more ?

Reply With Quote
  #3  
Old July 24th, 2002, 08:57 AM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: advanced forms in included php

could yuo post a link to your working and non-working code just to make things a bit clearer?

try print_r($_POST) in the included file?

Reply With Quote
  #4  
Old July 25th, 2002, 11:11 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: advanced forms in included php

the code is hard to post or to link, it has a number of interlinking objects.

I did try the print_r for $_POST and it came back as Array()

which I presume (from reading up on print_r means it is saying it is array BUT it is empty.)

When can $_POST go out of scope?????

Reply With Quote
  #5  
Old July 25th, 2002, 11:51 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: advanced forms in included php

doesn't mean it's an empty array, it might imply it's an array holding another array. try running the following to see what i mean.. although i haven't tested it
php Code:
Original - php Code
  1.  
  2. <?php
  3. function multiArray($myArray)
  4. {
  5.     echo "<ul>n";
  6.  
  7.     if(is_array($myArray))
  8.     {
  9.         foreach($myArray as $key=>$value)
  10.         {
  11.             if(is_array($value))
  12.             {
  13.                 multiArray($value);
  14.             }
  15.             else
  16.             {
  17.                 print("<li>$key: $value<br>n");
  18.             }
  19.         }
  20.     }
  21.     else
  22.     {
  23.         print("<li>$myArray is not an array.");
  24.     }
  25.  
  26.     echo "</ul>n";
  27. }
  28. multiArray($_POST);
  29. ?>

Reply With Quote
  #6  
Old July 26th, 2002, 02:11 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: advanced forms in included php

Actually, print_r should display a multi-dimensional array with no problems. So I believe that $_POST might be empty...

As for when $_POST would go out of scope...it didn't think it should every be out of scope...

I am having a hard time understanding exactly what your app is doing, so it is hard to determine what the problem is. You said that you are creating a pop-up window. Are you sure that you are POSTing data to the pop-up window? I know you said it was hard to post code, but is there anyway you can recreate this with a real stripped down version?


Reply With Quote
  #7  
Old July 26th, 2002, 07:56 AM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: advanced forms in included php

yeah. print_r is short for print_recursive..

If you get Array(), that means that you have access to the variable and it's an empty array.

Did you print_r after posting the form? try print_r($_GET), print_r($_HTTP_POST_VARS), or if that doesn't work try print_r($GLOBALS) and see if you can track your variable somewhere inbetween the mess.

You said you recreated the setup? where? on the same server? what version of php is running on the server?

Reply With Quote
  #8  
Old July 26th, 2002, 03:46 PM
Taoism Taoism is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Winnipeg, MB, Canada
Posts: 81 Taoism User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 2
RE: advanced forms in included php

I just submitted a couple debug functions to the site... you may find them useful for seeing what is going on. You can view what is in multiple scopes side-by-side (I find them useful for viewing session/post scopes side-by-side on occassion). I'll clean up the code for them in a bit...

They may help to find what is going on...

Debug Functions

[edited to add]: OK, why be lazy about it...I cleaned up the code and did some better documenting of the functions.


Cheers,
Keith.

Reply With Quote
  #9  
Old July 30th, 2002, 11:10 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: advanced forms in included php

looks like this is getting a lot of people trying to help, thanks, your efforts are greatly appreciated.

Well I was doing other things I redesigned the way the function worked and still the problem.

Let me explain what exactly is happening.

In a database I have a record which holds a entry called script. This holds a file which has a chunk of php code in it which I wanted to run. (I check the code runs but the $_POST is NOT in scope.

majorly striped code

function showFormhead()
{
print "<form name="".$this->name."" method="post" action="http://".$_SERVER["HTTP_HOST"].$_SERVER["REQU$

$doscript = 1;
foreach ($this->myboxes as $cur)
if ($cur->chkInputbox() == 0)
$doscript = 0;

if ($doscript == 1)
{
$includefile = $this->getcontentroot()."/".$this->name."/".$this->script;
include $includefile;

return $doscript;
}

--------
(not real but demos)

$mymsg = "Name : ".$_POST['name']."n";
$mymsg = $mymsg."Email : ".$_POST['email']."n";
$mymsg = $mymsg."Company : ".$_POST['company']."n";
$mymsg = $mymsg."Extras : n".$_POST['extras']."n";

print $mymsg;

---------------
what shows up is everything except the values for the $_POST calls.

I hope this helps, I wonder if I actuall have a text block in my db with the code in it and run it like that if that would work.

$_POST is definatly going out of scope when it goes into the include file but in a test script it does not. I just get it. I thought it could never go out of scope. SO what else could it be, the complexity?

Thanks again

Reply With Quote
  #10  
Old July 31st, 2002, 03:05 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: advanced forms in included php

hmmm, I was thinking my around the idea of having a block of code in a database which I could grab and execute, is this even possible???


Reply With Quote
  #11  
Old July 31st, 2002, 03:51 AM
madhombre madhombre is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: WI
Posts: 247 madhombre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: advanced forms in included php

decided to join up.

I managed to get the code accessible

http://jons.dotnet.com:8080/sitebuilder

The objects are in the objects dir (imagine that)

quick brief

form.obj.php is the one to look at

I am quite new to php so it may be something obvious (more of a c++ man) but I have not coded in a while so please me nice.

Thanks

Reply With Quote
  #12  
Old August 2nd, 2002, 05:52 AM
madhombre madhombre is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: WI
Posts: 247 madhombre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: advanced forms in included php

I post my code and then everyone desserts me!

*weep*

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > advanced forms in included php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |