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:
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  
Old August 9th, 2002, 02:01 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
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?????



Reply With Quote
  #2  
Old August 9th, 2002, 07:50 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com 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 siteworkspro.com Send a message via AIM to siteworkspro.com
RE: advanced forms in included php - part 2

your site is downed!

Reply With Quote
  #3  
Old August 10th, 2002, 09:12 PM
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 - part 2

SORRY, I forgot the port change!

The link is here
http://jons.dotnet.com:8080/sitebuilder/objects/form.obj.php

Reply With Quote
  #4  
Old August 10th, 2002, 09:13 PM
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 - part 2

I will looking to using sessions, thanks.

Reply With Quote
  #5  
Old August 10th, 2002, 10:03 PM
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 - 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!!!

Reply With Quote
  #6  
Old August 10th, 2002, 10:43 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
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'];


Reply With Quote
  #7  
Old August 11th, 2002, 12:32 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 - 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?????

Reply With Quote
  #8  
Old August 11th, 2002, 02:06 AM
Gipz Gipz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stockholm, Sweden
Posts: 98 Gipz 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 Gipz
RE: advanced forms in included php - part 2

Quote:
then I go into my include and low and behold do
$_SESSION['name'];


try "print $_SESSION['name'];"

Reply With Quote
  #9  
Old August 11th, 2002, 02:45 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 - 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?

Reply With Quote
  #10  
Old August 11th, 2002, 04:39 AM
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 - 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.
php Code:
Original - php Code
  1.  
  2. <?php
  3. if(isset($_POST['myvar'])){
  4.   $myvar=$_POST['myvar'];
  5. }
  6. ?>


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.

Reply With Quote
  #11  
Old August 12th, 2002, 12:02 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: RE: advanced forms in included php - part 2


Quote:
$_SESSION[$this->name] = $POST[$this->name];
...
$_SESSION['name'];

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:
Caution
This registers a global variable. If you want to register a session variable inside a function, you need to make sure to make it global using global() or use the session arrays as noted below.

Reply With Quote
  #12  
Old August 14th, 2002, 05:07 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 - 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.

Reply With Quote
  #13  
Old August 14th, 2002, 05:11 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 - part 2

wat version php you got running there?

Reply With Quote
  #14  
Old August 18th, 2002, 12:00 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 - 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?

Reply With Quote
  #15  
Old August 25th, 2002, 02:37 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 - 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.

Reply With Quote
Reply

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


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