Please help.. Simple php forums

0 Shubham Verlekar · March 13, 2015
So, I'd like to use php and get username in page "A" and say Hi {Username} somewhere in page B..
It really bugs out when I do "Echo" in Bootstrap..
Can anyone give me this code from scrath? please..

Post a Reply

Replies

Oldest  Newest  Rating
+1 Mohamad Mirohamadi · March 13, 2015
This is a very simple example, you can also store name in $_SESSION and use it in other pages.

PageA.php

<!DOCTYPE html>
<html>
<head>
   <title>PAGE A</title>
</head>
<body>
<form action="PageB.php" method="post">
   <input type="text" name="name" />
   <input type="submit" value="send name" />
</form>
</body>
</html>


PageB.php

<?php
   $name = $_POST['name'];
?>
<!DOCTYPE html>
<html>
<head>
   <title>Page B</title>
</head>
<body>
   <p><?php echo $name; ?></p>
</body>
</html>
  • 1

PHP

107,321 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators