Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass args to a php script : PHP newbie question 1

Status
Not open for further replies.

ro0tless

Programmer
Jan 3, 2005
4
JP
I got into a trouble passing args to a php script.

I made a test script on my machine but it doesn't seem to receive my argument......

What's wrong with my script/url. plz help!!!

Thanks in advance. :)

I call my php like this
" (phptest is my virtualhost name)

My script
---test4.php-----
<html>
<head>
<title>PHP Test4</title>
</head>
<body>
<?php
$foo = "foobar";

print ("foo is $foo<br>");
print ("arg is $arg");
?>
</body>
</html>
-------end----------

Result
--------------------
---------snip-----------
foo is foobar
arg is
-------------------------

Luckiest in the world
 
PS:

I don't want to modify my php script. I want to change just url.

Luckiest in the world
 
I think you must change your script.

You're probably running a version of PHP which has the php.ini setting register_globals set to "off". Leave register_globals set to "off", for the reasons listed here

If register_globals is set to "off", the variable $arg will not be set, but the value is available in $_GET['arg']. See the PHP online manual appendix on Predefined variables





Want the best answers? Ask the best questions!

TANSTAAFL!!
 
PS

If you can pass an argument (in this case "arg") from another .html script by "post", it is also nice to me.

please help me!!

Luckiest in the world
 
Thanks sleipnir214!!! My problem solved!!!!

VOTE GIVEN!!!

Luckiest in the world
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top