473,854 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

3 New Member
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 3941
201 New Member
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
3 New Member
hey its still not working n thnx 4 help....
Mar 9 '10 #3
5,058 Recognized Expert Expert

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
3 New Member
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 Recognized Expert Expert
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
50 New Member
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 helped! What I have is a page that brings in products ordered by a certain company. Along with those values, I'm creating a text box at the end of each record that a user may or may not enter in an estimated delivery date. If the user does enter in a date I want that row of data submitted to a...
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 produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
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 company. There are 2 of us who want to simultaneously work on development. Does splitting the database and creating FE's work for this scenario? And if so, would the changes that both users make be saved into the original .mdb? Is there any good source that I can read more about this in detail...
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 my Table tblEmployees and match user name and password entered.My case now is I have Audit Trail Module which keeps records of modifications and current user, I wanted my audit trail to log the current user based on who has log from based on my Log in Form.please help ty HERES THE CODE FOR ON...
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 shouldnt be an error i think. this is the error: Could add the site entry because: Column count doesn't match value count at row 1. The query was INSERT INTO home (home_id, header, body, date_entered) VALUES ('Welcome!', 'What is a Progressive Parent? A Progressive Parent ... now i created...
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 data for the selected date, for all dates upto and icluding the selected date or all records on or after the selected date The user selects either "=", >=" or "<=" from a combo box and then a date from another combobox. The combination of thse two choices is then set in an unbound textbox so...
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 the user to tick which items have been billed. What I'm trying to do is to use another form to prompt the user for the ending date. The date entered is then used as the parameter in the subform SQL queries.
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 datebase, i will redirect them back to signup page again to re-signup, however, i would like to remain all the correct infromation, and let users re-entered their NRIC. how can i do this. can i use Session, but it seems cant work. any one can help me? my code in signup page is like this: ...
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 button I want three things to happen: 1. The form uploads to a database (the following code does this) 2. An e-mail notification is sent to a specified e-mail address. (I know this can be done in the database, but I would prefer it be contained within the ASP code for now, but cannot find...
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 hits the "next" button it should take him to a specific site. Also he has the option to check a checkbox "Remeber this choice" so that when he returns to the site it remembers what he has choosen from the drop down list and automatically takes him to a specific site. Here is my code:
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.