|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
advanced forms in included php - part 2
Well I followed all your hints and ideas and what I can tell you is that whether I try $_POST or $_GET, both show up empty in my include script.
my code is here http://jons.dotnet.com/sitebuilder/objects/form.obj.php look at the include, the $_POST is avaliable in the object but as soon as I skip into the included file (making sure I get the php tags) it loses scope!!! WHY????? |
|
#2
|
|||
|
|||
|
RE: advanced forms in included php - part 2
your site is downed!
|
|
#3
|
|||
|
|||
|
RE: advanced forms in included php - part 2
SORRY, I forgot the port change!
The link is here http://jons.dotnet.com:8080/sitebuilder/objects/form.obj.php |
|
#4
|
|||
|
|||
|
RE: advanced forms in included php - part 2
I will looking to using sessions, thanks.
|
|
#5
|
|||
|
|||
|
RE: advanced forms in included php - part 2
Sessions - I am totally new to these babies!
Is there a shortcut to just save the info and get to it? Anyone know a good tutorial on sessions & php, I have zero experience with even the concept, I know the basics of what they are and what they do, but I don't know how they work!!! |
|
#6
|
|||
|
|||
|
RE: advanced forms in included php - part 2
well... is this short enough for u?
[highlight=php] // to set: $_SESSION['foo']="bar"; // to get: echo $_SESSION['foo']; |
|
#7
|
|||
|
|||
|
RE: advanced forms in included php - part 2
Do you have to use the session_start()
stuff??? anyway, I set up an example adding the session_start etc. I added each item into the $_SESSION variable $_SESSION[$this->name] = $POST[$this->name]; then I checked print $_SESSION[$this->name]; contents were fine. then I go into my include and low and behold do $_SESSION['name']; and nothing outputs!!! so it appears I am losing scope on the $_SESSION object too! what I am trying to do which is so complicated????? |
|
#8
|
|||
|
|||
|
RE: advanced forms in included php - part 2
Quote:
try "print $_SESSION['name'];" |
|
#9
|
|||
|
|||
|
RE: advanced forms in included php - part 2
my mistake, I forgot to add the print in the post, of course I did the print in the code.
So any other ideas? |
|
#10
|
|||
|
|||
|
RE: advanced forms in included php - part 2
Often although I am dealing with variables in scopes like $_POST, $_GET, $_SESSION, etc, I don't like referencing them in my general code since down the road I may want to change which scope I am going to use, so what I do is pull everything out of the scope at the beginning of the page.
i.e. This way I only need to reference $myvar in the code from that point on. The development methodology I use makes regular use of includes, and I haven't had scoping issues doing what I do above to use the variable in files included later in the script. Perhaps a way for you to handle this would be to have a code snippet like above in the showFormHead() function and then reference the local variable in the included script? Cheers, Keith. |
|
#11
|
||||
|
||||
|
RE: RE: advanced forms in included php - part 2
Quote:
obviusly, $this->name and 'name' is not the same... for debuging, try dumping a whole $_SESSION array with var_dump($_SESSION) also note that u can only registrer global variables... from the http://php.net/session-register Quote:
|
|
#12
|
|||
|
|||
|
RE: advanced forms in included php - part 2
I tried use see what $_SESSION was storing, and it came back with an empty array
also I have tried to use variables from the main file inside an include and none have scope. regarding each page, if you notice, the screen class is used for every page I create, so it will be on every page. as for the fact that that I did not reference correctly, and the two diffs were not the same - let me assure you they are. Thanks for the help, keep trying. |
|
#13
|
|||
|
|||
|
RE: advanced forms in included php - part 2
wat version php you got running there?
|
|
#14
|
|||
|
|||
|
RE: advanced forms in included php - part 2
PHP version 4.12
I seem to have stumped a great deal of people, guess I will have to think creativly, what would be the best way around this? write the info to the files? |
|
#15
|
|||
|
|||
|
RE: advanced forms in included php - part 2
why o why do I always have the impossible problems!!!
Well, I see everyone here has given up, I tried everything $_POST, sessions, the code is right and still nothing, can;t seem to transfer variables to my included script. maybe I can ask the php development, someone said includes are buggy. I will make a new topic to see if anyone can think of a different why to do it. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > advanced forms in included php - part 2 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|