472,331 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

take the user name entered in text box to another form??

How to i move information posted in one form to another?

Code done on login form.
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. // this starts the session 
  3. session_start(); 
  5. // this sets variables in the session 
  6. $_SESSION['username']=$_POST['username']; 
  8. ?> 
Code done on loginarea(where the name is to be displayed)..
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // this starts the session 
  3. session_start(); 
  4. // echo variable from the session, we set this on our other page 
  5. echo "welcome ".$_SESSION['username']; 
  7. ?> 
Mar 9 '10 #1
6 3846
201 100+
you can use it by starting the session on the next page and assigning it to a variable. i.e.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. $username = .$_SESSION['username'];
  5. echo $username;
  6. ?>
Mar 9 '10 #2
hey its still not working n thnx 4 help....
Mar 9 '10 #3
5,058 Expert 4TB

How exactly is it not working?
Is it printing nothing?
Or is it printing something else?

Are you getting any errors?
Do you have the error messages turned on?

Is there anything else going on that might help us determine what is really going on?

Assigning it to a variable is purely optional. The $_SESSION super-global can be used just as any normal array can be used. - However, it is usually a good idea to extract and validate data from external sources (sessions, post, get, cookies, databases, etc...) before using them.
Mar 9 '10 #4
no errors no warnnings nothing it just prints nothing means
its like this ...
n if i write like this ...
then it prints
welcome mansi
Mar 9 '10 #5
5,058 Expert 4TB
In that case, there are really only two reasons why this is happening.
  1. Your $_POST data isn't getting through correctly. If you print $_POST['username']; in the login page, does it print correctly?
  2. The session cookie is not working properly. In this case, it would either be a problem with your browser or your server config.

Try this. Create a new PHP page and put this code in it:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. if(isset($_SESSION['c'])) {
  4.     $_SESSION['c'] ++;
  5. }
  6. else {
  7.     $_SESSION['c'] = 1;
  8. }
  9. echo $_SESSION['c'];
  10. ?>
Then open the page in your browser and hit refresh (F5) a bunch of times. The number should increase each time. - If it doesn't there is most likely a problem with your server. (Unless your browser is configured to not accept session cookies?)
Mar 9 '10 #6
If its a next-page deal( forms are in a sequence ) you could just use GET rather then POST assuming you don't need to carry over allot of information also its a "bad idea" to put passwords in GET.

Also make sure your submitting the forms using method POST.
Mar 9 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Renie83 | last post by:
Hi I really am going crazy! I'm using VBScript, ASP, and SQL My page reminds me of a shopping cart but looking at shopping cart examples has not...
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to...
by: abprules | last post by:
Can somehow tell me the best way for multi user development to occur in MS Access? The situation is: We are creating a new database for a small...
by: hary08 | last post by:
im doing a database for Hospital Admission, I have a log in form which prompt user for a password. The source of log in is to look for the values in...
by: so many sites so little time | last post by:
this time i am going to use the scripts from the book and just change the names to match what i am trying to do now i just got an error that i know...
by: Mark Roughton | last post by:
I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related...
by: jgrob3 | last post by:
I have a form which contains two subforms: and . The two subforms each have a SQL query to display their results in datasheet view and allow...
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in...
by: daJunkCollector | last post by:
Hey, I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit...
by: printline | last post by:
Hi all I have a problem with a form script. The form script should do the following: When a user selects a value from a drop down list and...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.