Variable Passing Not Sending Complete Name

This is a discussion on Variable Passing Not Sending Complete Name within the PHP Language forums, part of the PHP Programming Forums category; I have a PHP script which simply calls another PHP script using include(). Let's call them website.php and ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-15-2007
Jerim
 
Posts: n/a
Default Variable Passing Not Sending Complete Name

I have a PHP script which simply calls another PHP script using
include(). Let's call them website.php and website_include.php, with
website.php simply including website_include.php. I can pass the
variable to website.php fine. Using an echo command, I can see that it
has the complete phrase such as "Permission Denied." When I call the
website_include.php, which is the page that actually does all the
work, the variable has changed to just "Permission." This happens with
any phrase I send. I am using the following syntax to call
website_include.php:

include("http://www.domain.com/website_include.php?variable=$phrase)

Right now, at the top of website.php and website_include.php I have a
$_GET statement to capture the variable. I have tried various
combinations of one page having it and the other not having. Having
the $_GET statement on both pages is the only way it has worked for me
so far. Any help will be greatly appreciated.

Reply With Quote
  #2 (permalink)  
Old 08-15-2007
Rik
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

On Wed, 15 Aug 2007 15:17:47 +0200, Jerim <wyount@gmail.com> wrote:

> I have a PHP script which simply calls another PHP script using
> include(). Let's call them website.php and website_include.php, with
> website.php simply including website_include.php. I can pass the
> variable to website.php fine. Using an echo command, I can see that it
> has the complete phrase such as "Permission Denied." When I call the
> website_include.php, which is the page that actually does all the
> work, the variable has changed to just "Permission." This happens with
> any phrase I send. I am using the following syntax to call
> website_include.php:
>
> include("http://www.domain.com/website_include.php?variable=$phrase)


Really try to use the local filesystem if you can, not a roundabout by
HTTP. It's unneccessary and cumbersome in most cases.

Your problem is in this case you should have urlencoded() the $phrase,
spaces are _not_ valid in the query string of an url.

Much easier would be:

website.php
<?php
$phrase = 'Test this.';
include('./website_include.php');
?>

website_include.php
<?php
echo $phrase;
?>
--
Rik Wasmus
Reply With Quote
  #3 (permalink)  
Old 08-15-2007
Jerim
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

On Aug 15, 8:22 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 15 Aug 2007 15:17:47 +0200, Jerim <wyo...@gmail.com> wrote:
> > I have a PHP script which simply calls another PHP script using
> > include(). Let's call them website.php and website_include.php, with
> > website.php simply including website_include.php. I can pass the
> > variable to website.php fine. Using an echo command, I can see that it
> > has the complete phrase such as "Permission Denied." When I call the
> > website_include.php, which is the page that actually does all the
> > work, the variable has changed to just "Permission." This happens with
> > any phrase I send. I am using the following syntax to call
> > website_include.php:

>
> > include("http://www.domain.com/website_include.php?variable=$phrase)

>
> Really try to use the local filesystem if you can, not a roundabout by
> HTTP. It's unneccessary and cumbersome in most cases.
>
> Your problem is in this case you should have urlencoded() the $phrase,
> spaces are _not_ valid in the query string of an url.
>
> Much easier would be:
>
> website.php
> <?php
> $phrase = 'Test this.';
> include('./website_include.php');
> ?>
>
> website_include.php
> <?php
> echo $phrase;
> ?>
> --
> Rik Wasmus


I appreciate the help, but that didn't work. The variable that
website.php is sending isn't hard coded. This system is for searching
names in a database. The variable that is getting passed is a persons
name. I start out with a page that lists all names, such as name.php.
All the names are clickable, so that you can get more details on that
person. So name.php passes the persons name onto website.php.
website.php catches the variable using a $_GET statement. Then it
calls website_include.php. The full variable name between website.php
and website_include.php is getting lost. Right now actually,
website_include.php isn't showing any name. So far, the only way to
get website_include.php to show even part of the name is to pass it
the name variable in the URL, and have website_include.php do a $_GET.

Reply With Quote
  #4 (permalink)  
Old 08-15-2007
Rik
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

On Wed, 15 Aug 2007 15:51:19 +0200, Jerim <wyount@gmail.com> wrote:

> On Aug 15, 8:22 am, Rik <luiheidsgoe...@hotmail.com> wrote:
>> On Wed, 15 Aug 2007 15:17:47 +0200, Jerim <wyo...@gmail.com> wrote:
>> > I have a PHP script which simply calls another PHP script using
>> > include(). Let's call them website.php and website_include.php, with
>> > website.php simply including website_include.php. I can pass the
>> > variable to website.php fine. Using an echo command, I can see thatit
>> > has the complete phrase such as "Permission Denied." When I call the
>> > website_include.php, which is the page that actually does all the
>> > work, the variable has changed to just "Permission." This happens with
>> > any phrase I send. I am using the following syntax to call
>> > website_include.php:

>>
>> > include("http://www.domain.com/website_include.php?variable=$phrase)

>>
>> Really try to use the local filesystem if you can, not a roundabout by
>> HTTP. It's unneccessary and cumbersome in most cases.
>>
>> Your problem is in this case you should have urlencoded() the $phrase,
>> spaces are _not_ valid in the query string of an url.
>>
>> Much easier would be:
>>
>> website.php
>> <?php
>> $phrase = 'Test this.';
>> include('./website_include.php');
>> ?>
>>
>> website_include.php
>> <?php
>> echo $phrase;
>> ?>
>> --
>> Rik Wasmus


Please don't quote signatures.

> I appreciate the help, but that didn't work.


What have you tried, using the local filesystem or urlencoding your GET
variable?

> The variable that
> website.php is sending isn't hard coded.


Which is irrelevant. If the variable exists in website.php be it static or
dynamic, it will exist in website_include.php if you include it using the
filesystem.

> So name.php passes the persons name onto website.php.
> website.php catches the variable using a $_GET statement. Then it
> calls website_include.php.


Still using http or indeed the filesystem now?

> The full variable name between website.php
> and website_include.php is getting lost.


Which I told you was because in HTTP you have to (raw)urlencode() the
values in the query string.
--
Rik Wasmus
Reply With Quote
  #5 (permalink)  
Old 08-15-2007
Jerim
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

On Aug 15, 9:00 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 15 Aug 2007 15:51:19 +0200, Jerim <wyo...@gmail.com> wrote:
> > On Aug 15, 8:22 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> >> On Wed, 15 Aug 2007 15:17:47 +0200, Jerim <wyo...@gmail.com> wrote:
> >> > I have a PHP script which simply calls another PHP script using
> >> > include(). Let's call them website.php and website_include.php, with
> >> > website.php simply including website_include.php. I can pass the
> >> > variable to website.php fine. Using an echo command, I can see that it
> >> > has the complete phrase such as "Permission Denied." When I call the
> >> > website_include.php, which is the page that actually does all the
> >> > work, the variable has changed to just "Permission." This happens with
> >> > any phrase I send. I am using the following syntax to call
> >> > website_include.php:

>
> >> > include("http://www.domain.com/website_include.php?variable=$phrase)

>
> >> Really try to use the local filesystem if you can, not a roundabout by
> >> HTTP. It's unneccessary and cumbersome in most cases.

>
> >> Your problem is in this case you should have urlencoded() the $phrase,
> >> spaces are _not_ valid in the query string of an url.

>
> >> Much easier would be:

>
> >> website.php
> >> <?php
> >> $phrase = 'Test this.';
> >> include('./website_include.php');
> >> ?>

>
> >> website_include.php
> >> <?php
> >> echo $phrase;
> >> ?>
> >> --
> >> Rik Wasmus

>
> Please don't quote signatures.
>
> > I appreciate the help, but that didn't work.

>
> What have you tried, using the local filesystem or urlencoding your GET
> variable?
>
> > The variable that
> > website.php is sending isn't hard coded.

>
> Which is irrelevant. If the variable exists in website.php be it static or
> dynamic, it will exist in website_include.php if you include it using the
> filesystem.
>
> > So name.php passes the persons name onto website.php.
> > website.php catches the variable using a $_GET statement. Then it
> > calls website_include.php.

>
> Still using http or indeed the filesystem now?
>
> > The full variable name between website.php
> > and website_include.php is getting lost.

>
> Which I told you was because in HTTP you have to (raw)urlencode() the
> values in the query string.


After playing around with it a bit, here is what you were trying to
say:

On website.php catch the variable using
$variable=rawurlencode($_GET['variable']);
Then when you call the include, pass the variable: include("http://
www.website.com/directory/website_include.php?variable=$variable");

Reply With Quote
  #6 (permalink)  
Old 08-15-2007
Rik
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

On Wed, 15 Aug 2007 16:24:15 +0200, Jerim <wyount@gmail.com> wrote:
> After playing around with it a bit, here is what you were trying to
> say:
>
> On website.php catch the variable using
> $variable=rawurlencode($_GET['variable']);
> Then when you call the include, pass the variable: include("http://
> www.website.com/directory/website_include.php?variable=$variable");


Well, preferably don't include by HTTP, but this will work.
--
Rik Wasmus
Reply With Quote
  #7 (permalink)  
Old 08-15-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Variable Passing Not Sending Complete Name

Jerim wrote:
> On Aug 15, 9:00 am, Rik <luiheidsgoe...@hotmail.com> wrote:
>> On Wed, 15 Aug 2007 15:51:19 +0200, Jerim <wyo...@gmail.com> wrote:
>>> On Aug 15, 8:22 am, Rik <luiheidsgoe...@hotmail.com> wrote:
>>>> On Wed, 15 Aug 2007 15:17:47 +0200, Jerim <wyo...@gmail.com> wrote:
>>>>> I have a PHP script which simply calls another PHP script using
>>>>> include(). Let's call them website.php and website_include.php, with
>>>>> website.php simply including website_include.php. I can pass the
>>>>> variable to website.php fine. Using an echo command, I can see that it
>>>>> has the complete phrase such as "Permission Denied." When I call the
>>>>> website_include.php, which is the page that actually does all the
>>>>> work, the variable has changed to just "Permission." This happens with
>>>>> any phrase I send. I am using the following syntax to call
>>>>> website_include.php:
>>>>> include("http://www.domain.com/website_include.php?variable=$phrase)
>>>> Really try to use the local filesystem if you can, not a roundabout by
>>>> HTTP. It's unneccessary and cumbersome in most cases.
>>>> Your problem is in this case you should have urlencoded() the $phrase,
>>>> spaces are _not_ valid in the query string of an url.
>>>> Much easier would be:
>>>> website.php
>>>> <?php
>>>> $phrase = 'Test this.';
>>>> include('./website_include.php');
>>>> ?>
>>>> website_include.php
>>>> <?php
>>>> echo $phrase;
>>>> ?>
>>>> --
>>>> Rik Wasmus

>> Please don't quote signatures.
>>
>>> I appreciate the help, but that didn't work.

>> What have you tried, using the local filesystem or urlencoding your GET
>> variable?
>>
>>> The variable that
>>> website.php is sending isn't hard coded.

>> Which is irrelevant. If the variable exists in website.php be it static or
>> dynamic, it will exist in website_include.php if you include it using the
>> filesystem.
>>
>>> So name.php passes the persons name onto website.php.
>>> website.php catches the variable using a $_GET statement. Then it
>>> calls website_include.php.

>> Still using http or indeed the filesystem now?
>>
>>> The full variable name between website.php
>>> and website_include.php is getting lost.

>> Which I told you was because in HTTP you have to (raw)urlencode() the
>> values in the query string.

>
> After playing around with it a bit, here is what you were trying to
> say:
>
> On website.php catch the variable using
> $variable=rawurlencode($_GET['variable']);
> Then when you call the include, pass the variable: include("http://
> www.website.com/directory/website_include.php?variable=$variable");
>


Yes, but he's also saying if you just

<?php include '/directory/website_include.php' ?>

the variable will be available there, also. And it's a lot faster and
easier on the server because PHP just gets the file from the filesystem
and doesn't require the webserver's involvement - like your method does.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0