"Krista" <yw*****@hotmail.com> wrote in message
news:eb**************************@posting.google.c om...
"SwissCheese" <Sw*********@cfl.rr.com> wrote in message
news:<ai*******************@twister.tampabay.rr.co m>...
"Krista" <yw*****@hotmail.com> wrote in message
news:eb*************************@posting.google.co m... Hi everybody,
I think my confi has some problems. Can you guys help me to see what
is going on?
i install Apache2.0.48 and Php4.3.4 in WinXP.
I add some codes in httpd(inside apache group/apache2)
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/sapi/php4apache2.dll"
AddType application/x-httpd-php .php
In addition, I put the php.ini file in Windows, put
php4ts.dll in system32. Anything else?
When I run apache and write some php code, I cannot
pass agrument between two php files. Do you guys have any idea?
Thanks.
Krista
page1 sends:
www.mysite.com/page2.php?var1="something"&var2="somethingelse"
page2 reads:
$var1 = $_GET["var1"]; // or $_PUT[]
$var2 = $_GET["var2"]; // or $_PUT[]
or just use $_GET[] or $_PUT[] throughout your script
Hi ,
I create two files.
testing.php:
<html>
<head><title>testing</title></head>
<body>
<form action = "testing1.php" method="get">
Enter our name:
<input type = "text" name="userName">
<input type ="submit" name="submit" value="Submit Now">
</form>
</body>
</html>
testing1.php:
<html>
<head><title>testing1</title></head>
<body>
<?php
print "Thanks $userName";
?>
</body>
</html>
However, I cannot show the name in testing1.php. Do you guys have any
idea?
You have declared this to be a 'GET' operation:
<form action = "testing1.php" method="get">
So, you need to refer to the incoming variable like this:
$HTTP_GET_VARS['id'] (Before PHP 4.1.0)
$_GET['id'] (PHP 4.1.0 and later)
or
$_REQUEST['id'] (PHP 4.1.0 and later).
In your case, that would be:
print "Thanks " . $_GET['userName'];
From the manual page
http://www.php.net/manual/en/languag....external.php:
Example 3.8. A simple HTML form
<form action="foo.php" method="POST">
Name: <input type="text" name="username"><br>
Email: <input type="text" name="email"><br>
<input type="submit" name="submit" value="Submit me!">
</form>
Depending on your particular setup and personal preferences, there are many
ways to access data from your HTML forms. Some examples are:
Example 3.9. Accessing data from a simple POST HTML form
<?php
// Available since PHP 4.1.0
print $_POST['username'];
print $_REQUEST['username'];
import_request_variables('p', 'p_');
print $p_username;
// Available since PHP 3. As of PHP 5.0.0, these long predefined
// variables can be disabled with the register_long_arrays directive.
print $HTTP_POST_VARS['username'];
// Available if the PHP directive register_globals = on. As of
// PHP 4.2.0 the default value of register_globals = off.
// Using/relying on this method is not preferred.
print $username;
?>
Using a GET form is similar except you'll use the appropriate GET predefined
variable instead. GET also applies to the QUERY_STRING (the information
after the '?' in an URL). So, for example,
http://www.example.com/test.php?id=3 contains GET data which is accessible
with $_GET['id']. See also $_REQUEST and import_request_variables().
HTH
Doug