| | |
Capturing username and displaying on another page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Ok, you need to look at a few tutorials (there's millions on the net) about user logins and sessions. In a nutshell:
Now please do some research so you understand that code and how your using it.
[code untested]
form.html This contains the textbox. html Syntax (Toggle Plain Text)
<form action="submit.php" method="GET"> <!--or "POST"--> <input type="text" name="username" /> </form>
submit.php Set the session variable php Syntax (Toggle Plain Text)
<?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 Syntax (Toggle Plain Text)
<?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]
★ "If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Video to FLV
- Next Thread: problem uploading photo in webserver
| Thread Tools | Search this Thread |
advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla js limit link login loop mail menu mlm multiple mysql oop parse password paypal pdf php problem procedure query radio random recursion regex remote script search server sessions smarty smash sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validator variable video web xml youtube





