Hi there,
I'm testing on passing parameter via url with the three php files as shown below:
1. index.php
2. pg2.php
3. pg3.php
The index.php will allow user to input something and then pass the variables to pg2.php to display.
In pg2.php, there is text url/link that will pass the variables to pg3.php and display again.
Problem: I could only pass the variables till pg2.php but not to pg3.php.
Here is the simple code that I have written:
Index.php
======
<html>
<head>
<title>Login</title>
</head>
<body onload=document.test.usern
ame.focus(
)>
<form method="POST" action="pg2.php" name="test">
Username: <input type="text" name="username" size="20">
Password: <input type="password" name="password" size="20"><br>
?>
<input type="submit" value="Submit" name="login">
</form>
</body>
</html>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----
pg2.php
=====
<html>
<head>
<title>Login</title>
</head>
<body>
<form action="pg3.php" method="POST">
Username input: <?php echo $_POST['username']."<br>";
?>
Password input: <?php echo $_POST['password']."<br><b
r>"; ?>
<a href="pg3.php?username=$_P
OST['usern
ame']">Go to Page 3</a>
</form>
</body>
</html>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----
pg3.php
=====
<html>
<head>
<title>Login</title>
</head>
<body>
<form method="POST">
This is page 3.<br><br>
<? php echo $_POST['username']; ?>
</form>
</body>
</html>
Please advise.
Thank you.
Start Free Trial