Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP and Apache confi problem

Krista
Guest
 
Posts: n/a
#1: Jul 17 '05
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

SwissCheese
Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP and Apache confi problem


"Krista" <ywan_ip@hotmail.com> wrote in message
news:eb97c972.0312051053.d18c5f3@posting.google.co m...[color=blue]
> Hi everybody,
> I think my confi has some problems. Can you guys help me to see what is[/color]
going on?[color=blue]
>
> 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
>[/color]

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


Krista
Guest
 
Posts: n/a
#3: Jul 17 '05

re: PHP and Apache confi problem


"SwissCheese" <SwissCheese@cfl.rr.com> wrote in message news:<airAb.30656$%h4.12745@twister.tampabay.rr.co m>...[color=blue]
> "Krista" <ywan_ip@hotmail.com> wrote in message
> news:eb97c972.0312051053.d18c5f3@posting.google.co m...[color=green]
> > Hi everybody,
> > I think my confi has some problems. Can you guys help me to see what is[/color]
> going on?[color=green]
> >
> > 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
> >[/color]
>
> 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[/color]

I don't understand. For example, my script is to ask a user to enter
his/her name and click enter button. The following page should print
the user's name. However, I don't know why I cannot pass the name in
next page. Is it the config problem?
Krista
Guest
 
Posts: n/a
#4: Jul 17 '05

re: PHP and Apache confi problem


"SwissCheese" <SwissCheese@cfl.rr.com> wrote in message news:<airAb.30656$%h4.12745@twister.tampabay.rr.co m>...[color=blue]
> "Krista" <ywan_ip@hotmail.com> wrote in message
> news:eb97c972.0312051053.d18c5f3@posting.google.co m...[color=green]
> > Hi everybody,
> > I think my confi has some problems. Can you guys help me to see what is[/color]
> going on?[color=green]
> >
> > 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
> >[/color]
>
> 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[/color]

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?
Doug Hutcheson
Guest
 
Posts: n/a
#5: Jul 17 '05

re: PHP and Apache confi problem


"Krista" <ywan_ip@hotmail.com> wrote in message
news:eb97c972.0312081331.1f8b66b9@posting.google.c om...[color=blue]
> "SwissCheese" <SwissCheese@cfl.rr.com> wrote in message[/color]
news:<airAb.30656$%h4.12745@twister.tampabay.rr.co m>...[color=blue][color=green]
> > "Krista" <ywan_ip@hotmail.com> wrote in message
> > news:eb97c972.0312051053.d18c5f3@posting.google.co m...[color=darkred]
> > > Hi everybody,
> > > I think my confi has some problems. Can you guys help me to see what[/color][/color][/color]
is[color=blue][color=green]
> > going on?[color=darkred]
> > >
> > > 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
> > >[/color]
> >
> > 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[/color]
>
> 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[/color]
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



Closed Thread


Similar PHP bytes