0

Hey all
How can i capture the username, which is being input in a textbox, and pass it to another page?

Login.php
Example,
username: admin

Welcome.php
it should display,
Welcome, admin

How can i achieve this?

Using dtreamweaver with PHP language

Thanks

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by humbug
0

you pass it via the $_GET method or the $_POST method.

Could you guide me on how to do that?
Im a beginner in php

0

Ok, you need to look at a few tutorials (there's millions on the net) about user logins and sessions. In a nutshell: form.html This contains the textbox.

<form action="submit.php" method="GET"> <!--or "POST"-->
  <input type="text" name="username" />
</form>

submit.php Set the session variable

<?php
session_start(); //so you can use the session variable
&username = $_GET['username']; //or $_POST depending on form method
echo "Hello $username. I have learnt your name!";
SESSION['username']=$username;
?>
<a href="/page.php">Return</a>

page.php //Content page

<?php
start_session();
if isset($_SESSION['username']){
  echo "Hey $_SESSION['username'], I remembered your name!";
}
?>
...rest of page content

Now please do some research so you understand that code and how your using it.

[code untested]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.