Jump to content

Need HELP on tracking session variables


huiling25

Recommended Posts

I had made a e-shopping website. But the problem i have is getting the session variable "username" to print out on the webpage. I used PHP5, MySQL5.0, IIS Server, XP Pro, Dreamweaver MX2004 to create the website. I remembered putting session_start() at the top of the codes, but the session variable still cannot be printed out using "<?php echo $_SESSION['MM_Username'];?>". Can anyone help me?

Link to comment
Share on other sites

first off I have to say (DON"T USE DREAMWEAVER!!!)white space isues/bad program and a simple text editor does 100x better for you for scripting.  Secondly to get a session your idea is right and session_start(); must appear before any headers/output is sent, but are you actually assigning a value to $_SESSION['MM_Username']? you must have  a page that says $_SESSION['MM_username'] = $row['userID']; for example

Link to comment
Share on other sites

its not a good scripting editor by far.  Also its html previews are not crossbrowser compatible and it fails to write in tableless designs which is become xhtml strictness very soon.  It will have issue for you if you try and make universal scripts and you should be using a basic text editor (one with prettyprint is always nice).  A good script editing software can do these things and these only:

 

1) Pretty Print text in different languages

2) Collapse Functions down/ blocks { }

3) Give an accurate line number count

4) have a good find and replace function

5) Optional, but nice a FTP in program that auto updates server when file is saved.

 

What it must not do:

1) execute scripts in edtior

2) Show resultant code possibility

3) Write code for you (outside of regex)

 

Link to comment
Share on other sites

In the critical page try printing the session value by manually assigning some values.

 

Ex:

session_start();

$_SESSION['name']="John";

 

In another page try to retrieve the value and test.

 

session_start();

$name=$_SESSION['name']; echo"$name";

 

If this is helpful then slowly replace this arbitrary value with the variable that u desire.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.