| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | PHP Session Help Helloooo Im using this PHP session to display data when a user logs in. e.g. session_start(); echo $_SESSION[console]; Basically - Its displaying their favourite games console in text. The session will either display 'Xbox 360', 'Playstation 3' or 'Nintendo Wii'. Is it possible to display a picture of their favourite console? For example: if [console] = 'Xbox 360' -> display ../images/xbox360.jpg You get what I mean! Thanks for reading
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre |
| |
| | #2 (permalink) |
| Pro Coder & Designer Join Date: Apr 2005 Location: Netherlands
Posts: 967
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Why not use cookies? Because if you use sessions and they close theire window, they have to reassign what favorite console they have. edit: Code: <?php
if(isset($_POST['choose_console'])) {
if($selection == "1") {
$_SESSION['console_1'] = $console_1;
session_register("console_1");
}
}
if(isset($_SESSION['console_1'])) { echo "<img src=picture.jpg>"; }
?>
etc...
(didnt test the code )
__________________ aween web development
Last edited by aween; 05-27-2006 at 01:59 PM.
|
| |
| | #4 (permalink) |
| Buy my domains. Join Date: Feb 2006
Posts: 2,796
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: abdulmueid: yours wouldn't echo an image, just the path to it. |
| |
| | THREAD STARTER #5 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | xlusive - the user chose their favourite console when they registered. Thanks any way. Hi abdulmueid I can't get this code to work but thanks for trying. David.
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre |
| |
| | #6 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | There are other..probably even better ways to do it, but: PHP Code: |
| |
| | THREAD STARTER #7 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | Thanks to both Dan Friedman and SecondVersion! I was just about to kill myself! Thanks again
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre |
| |