huiling25 Posted July 16, 2007 Share Posted July 16, 2007 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? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 16, 2007 Share Posted July 16, 2007 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 Quote Link to comment Share on other sites More sharing options...
huiling25 Posted July 16, 2007 Author Share Posted July 16, 2007 Hmm, my whole website is using dreamweaver T_T. MM_Username is assigned by dreamweaver. if i don't use dreamweaver, then i should hard-code it? but i already done 3/4 of the website using dreamweaver. >_< Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 16, 2007 Share Posted July 16, 2007 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) Quote Link to comment Share on other sites More sharing options...
huiling25 Posted July 16, 2007 Author Share Posted July 16, 2007 Hmm, so, what can i do now? i do not want to spend time to do another hand-code website >_<. Have any idea how to make the session variable work? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 16, 2007 Share Posted July 16, 2007 well i'm sorry, but we cant really help people who don't understand their own scripts. Quote Link to comment Share on other sites More sharing options...
huiling25 Posted July 16, 2007 Author Share Posted July 16, 2007 Ok, thanx, i tink i will do the log in user by hand-coding. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted July 16, 2007 Share Posted July 16, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.