?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Get ?varibles to PHP files via URL
Author:??(---.nycap.rr.com)
Date:???03-05-03 22:05

Hello, I have not found any resources on the net that explain how to get Command Line arguments on a PHP file. For example, to get an Argument to a Win32 CPP Program I would do:

int main(int argc, char** argv[])
{
printf(argv[1]); //-First Arg
printf(argv[2]); //-Second Arg
return 0;
}

So far, the Websites I have been to, say that i jsut pass a varible(s) to the file like so:

http://some.website.com/file.php?var1=hello&var2=world

and In the PHP file I do:

print "$var1 $var2";
?>

But! When I Run the PHP file, with the correct arguments, I get an error such as:

Notice: Undefined variable: var1 in c:\apache\dumpedroot\geofiles\new york\saratoga county\data\cities\saratoga springs\get.php on line 3

Notice: Undefined variable: var2 in c:\apache\dumpedroot\geofiles\new york\saratoga county\data\cities\saratoga springs\get.php on line 3

So, I assume I am doing this wrong :) Any Ideas?

-Richard

?Topics Author? Date
?Get ?varibles to PHP files via URL??new
Richard Krupski 03-05-03 22:05?
?Re: Get ?varibles to PHP files via URL??new
Andi 03-06-03 01:15?
?Re: Get ?varibles to PHP files via URL??new
http://www.uday.com.np/php 03-06-03 20:00?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
????

Provided By
Phorum