473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to use session uniquely each time page loads?

i want to use unique session values, set according to if condition. To use in same page.
Like this
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. session_start();
  4. ?> <form action="http://bytes.com/nn.php" method="post">
  5. Username: <input type="text" name="lname"  /><br><br>
  6. Password: <input type="password" name="password" /><br><br> <input type="submit" name="submit"/> </form> <?php if(isset($_POST['submit']) && $_POST['submit'])
  7. {
  8. echo "ok";
  9. $_SESSION['a']="same";
  10.  
  11. }
  12. echo $_SESSION['a'];
  13.  
  14.  
  15.  
  16. ?>
But each time i load the page, i get the same session values even before i click submit button..
Any Help greatly appreciated.. Thanks in advances
Jan 13 '13 #1
1 1693
Exequiel
288 256MB
Expand|Select|Wrap|Line Numbers
  1. if($_SESSION['user']=='' && $_SESSION['pwd']==''){
  2.      echo 'Stay here.';
  3. }else{
  4.      echo 'Success';
  5. }
  6.  
Try this. . .
Jan 14 '13 #2

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

Similar topics

6
by: google | last post by:
I would like to find a way to execute a query against an MS SQL server and return a small number of rows each page load. However, I cannot read all the results in during the first page load due to...
4
by: techy techno | last post by:
hiii I wanted to know how can I check for a specific HTML tag or user defined TEXT and delete it when the page loads Whenver the IE loads the page my company add its COMPANY NAME in my office...
1
by: Amadelle | last post by:
Hi all and thanks in advance, I was wondering how to cache/persist a dataset between page loads (after button clicks, sorts, filters, etc.)? so that i don't have to requery the database...
5
by: Samy | last post by:
Hi There, I have a stored procedure which takes 7 sec to execute. I am using a adapter and filling the dataset. Then I bind the datagrid with the datatable from the dataset. When I test the page...
0
by: Antonio | last post by:
Hi, we are trying to create a page for our users that contains a lot of data. One datagrid loads very slow because the query behind it is complex. We would like to load up the page to the user...
1
by: mark | last post by:
Hi I am trying to count the number of times a page loads. When I hit the submit button I can get the page to count once using ispostback to check . I am trying to incriment a variable everytime...
3
by: James | last post by:
My web application is comprised of a Login page and then several other pages nested in a masterpage. I am using a cookiless="UseUri" session configuration. I have a linkbutton on the masterpage for...
1
by: cinergy | last post by:
Can someone provide a sample of how to display a different background image in a table cell each time the page loads? I am only able to find scripts to display a different picture outside a table...
1
by: Healthy Stealthy | last post by:
Hello, I would like my webpage to load a different Flash image each time the website loads, much like a different image loads. Can this be done with a simple Javascript in the header? Thanks for...
13
by: raamay | last post by:
i have the following code which is generated from a .dwt template. My problem is that the page loads but only the header part displays and rest of the contents are not displayed. Everything works...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...

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.