Page 1 of 1

Passing parameter to another page

PostPosted: 05. May 2006 15:32
by miky
Hello friends.
I an new to xampp (switched from php home edition). Is seems great.
Can anyone help with this problem.
I start "index.php" with a form (user and password) and call "login.php"
but in login.php I have no parameters. Thanks forward



<?php INDEX.PHP
//========== ?>
<html><head></head><body>
<form method="get" action="login.php">
User:<br> <input type=text name="uid" size=20> <br>
Pswd:<br> <input type=password name="pwd" size=20>
<br>
<input type=submit name=ok value="LogIn">
</form>
</body></html>

<?php LOGIN.PHP
//========== ?>
<html><head></head><body>
<?echo "Name (uid): ".$uid."<br>"?>
<?echo "Pssw (pwd): ".$pwd."<br>"?>
</body></html>

kysel.miroslav@zoznam.sk

PostPosted: 05. May 2006 15:38
by Wiedmann
Please read the PHP manual about "external variables".

PostPosted: 05. May 2006 17:47
by miky
Thanks I have set the parameter and it works.
./xampp/apache/bin/php.ini
register_globals=on
miky

PostPosted: 05. May 2006 18:53
by Wiedmann
I have set the parameter and it works.

IMHO that's the wrong way. Why not using the correct syntax to access these values?

PostPosted: 05. May 2006 22:58
by WorldDrknss
Index.php
<html><head></head><body>
<form method="get" action="login.php">
User:<br> <input type=text name="uid" size=20> <br>
Pswd:<br> <input type=password name="pwd" size=20>
<br>
<input type=submit name=ok value="LogIn">
</form>
</body></html>

login.php
<html><head></head><body>
<?php
$uid = $_GET['uid'];
$pwd = $_GET['pwd'];
echo "Name (uid): ".$uid."<br>";
echo "Pssw (pwd): ".$pwd."<br>";
?>
</body></html>