nevx Posted March 15, 2006 Share Posted March 15, 2006 I need some help on this onei have 3 pages , one is a simple html page user.html where<form action='processform.php' method="post">Please type your name herebr><input type=text name="username"><br><br><input type=submit value="submit"><br><br></form>------------------------------------------------------------------------<!--processform.php--><p>Welcome <nbsp;><?php echo($_POST['username']);?>!</P><br><br><a target="_new" href="name.php" >Show Name</a>-----------------------------------------------------------------<!--name.php--><html><body><p>Applicant : <?php echo($_POST['username']);?></p>-------------------why can't i see the variable in name.php any help appreciatedi'm using WAMP5 Version 1.6.1 Quote Link to comment https://forums.phpfreaks.com/topic/5005-sharing-variables-between-scripts/ Share on other sites More sharing options...
klinmy Posted March 15, 2006 Share Posted March 15, 2006 . Quote Link to comment https://forums.phpfreaks.com/topic/5005-sharing-variables-between-scripts/#findComment-17693 Share on other sites More sharing options...
keeB Posted March 15, 2006 Share Posted March 15, 2006 Well.. the short answer is because you're not POST'ing any data from "processform.php" to name.php.Let's modify those 2 files really quick..[code]<!--processform.php-->$uname = $_POST['username'];<p>Welcome <nbsp;><?php echo($uname);?>!</P><br><br><a target="_new" href="name.php?name=<?php echo($uname); ?>" >Show Name</a>[/code]annnnnnnnnnnnnnnd..[code]<!--name.php-->$uname = $_GET['name'];<html><body><p>Applicant : <?php echo($uname);?></p>[/code]So let's look at the changes..In the first file.. we have data POSTed from the previous page, and we take that data and add it to the URL of the link we're making. Data added to the URL after the .php? mark are referred to by the $_GET[]; array..I hope this makes sense.. if you are confused about any part, please don't hesitate to ask. :) Quote Link to comment https://forums.phpfreaks.com/topic/5005-sharing-variables-between-scripts/#findComment-17712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.