|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
RE: advanced forms in included php
Can U give us a chunk of code so we can understand a little more ?
|
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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????? |
|
#5
|
|||
|
|||
|
RE: advanced forms in included php
|
|
#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? |
|
#7
|
|||
|
|||
|
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? |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
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 |
|
#10
|
|||
|
|||
|
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???
|
|
#11
|
|||
|
|||
|
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 |
|
#12
|
|||
|
|||
|
RE: advanced forms in included php
I post my code and then everyone desserts me!
*weep* |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > advanced forms in included php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|