Passing parameters

This is a discussion on Passing parameters within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I wrote the following php script : <? echo $myvar; ?> then i open IE and i give the adress : ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-02-2005
Fifou
 
Posts: n/a
Default Passing parameters

Hi,

I wrote the following php script :

<? echo $myvar; ?>


then i open IE and i give the adress :
http://localhost/Myscript.php?myvar=test


This returns the following error :
Notice: Undefined variable: myvar in c:\program
files\easyphp1-8\www\test.php on line 3

I thought that "myvar" should be known by the script because i send it
through the URL. But it does not work. Do you know why ?

Thanks a lot for your help



Reply With Quote
  #2 (permalink)  
Old 10-02-2005
John
 
Posts: n/a
Default Re: Passing parameters

On Sun, 2 Oct 2005 10:48:30 -0400, "Fifou"
<NOSPAM_fr_chapelle@hotmail.com> wrote:

>Hi,
>
>I wrote the following php script :
>
><? echo $myvar; ?>
>
>
>then i open IE and i give the adress :
>http://localhost/Myscript.php?myvar=test
>
>
>This returns the following error :
>Notice: Undefined variable: myvar in c:\program
>files\easyphp1-8\www\test.php on line 3
>
>I thought that "myvar" should be known by the script because i send it
>through the URL. But it does not work. Do you know why ?
>
>Thanks a lot for your help


Try

echo $_GET['myvar']

--
John
Reply With Quote
  #3 (permalink)  
Old 10-02-2005
Janwillem Borleffs
 
Posts: n/a
Default Re: Passing parameters

Fifou wrote:
> This returns the following error :
> Notice: Undefined variable: myvar in c:\program
> files\easyphp1-8\www\test.php on line 3
>
> I thought that "myvar" should be known by the script because i send it
> through the URL. But it does not work. Do you know why ?
>


Try:

<?php print $_GET['myvar'] ?>

Read:

http://www.php.net/register_globals


JW



Reply With Quote
  #4 (permalink)  
Old 10-02-2005
Fifou
 
Posts: n/a
Default Re: Passing parameters

Thanks a lot. It works now ! You were right. I now have to use $_GET


"John" <yuiwedo@dfijyu> a écrit dans le message news:
brsvj1p12ab162thgt31hbkdgvas162mpi@4ax.com...
> On Sun, 2 Oct 2005 10:48:30 -0400, "Fifou"
> <NOSPAM_fr_chapelle@hotmail.com> wrote:
>
> >Hi,
> >
> >I wrote the following php script :
> >
> ><? echo $myvar; ?>
> >
> >
> >then i open IE and i give the adress :
> >http://localhost/Myscript.php?myvar=test
> >
> >
> >This returns the following error :
> >Notice: Undefined variable: myvar in c:\program
> >files\easyphp1-8\www\test.php on line 3
> >
> >I thought that "myvar" should be known by the script because i send it
> >through the URL. But it does not work. Do you know why ?
> >
> >Thanks a lot for your help

>
> Try
>
> echo $_GET['myvar']
>
> --
> John



Reply With Quote
  #5 (permalink)  
Old 10-02-2005
Janwillem Borleffs
 
Posts: n/a
Default Re: Passing parameters

Fifou wrote:
> Thanks a lot. It works now ! You were right. I now have to use $_GET
>


Don't forget to read http://www.php.net/register_globals


JW



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 07:02 PM.


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