LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-08-2006, 04:25 PM   #1
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Rep: Reputation: 15
display field by colour chosen using sessions?


thanks

well here it is, i have the the code to write the lines for the fields chosen in the index page from the first set of check boxes.

PHP Code:
                if (isset($_SESSION['checkbox2'])) {
                        
fwrite($handle,'<th>county_UA</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox3'])) {
                        
fwrite($handle,'<th>pop_code</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox4'])) {
                        
fwrite($handle,'<th>favourite_instrument</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox5'])) {
                        
fwrite($handle,'<th>bbb</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox6'])) {
                        
fwrite($handle,'<th>id</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox7'])) {
                        
fwrite($handle,'<th>fruit</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox8'])) {
                        
fwrite($handle,'<th>prizes</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox9'])) {
                        
fwrite($handle,'<th>fguk_code</th>'."\n");
                           }
                if (isset(
$_SESSION['checkbox10'])) {
                        
fwrite($handle,'<th>fgeu_code</th>'."\n");
                           }
                
fwrite($handle,'</tr>'."\n"); 
this basicaly produces

[HTML]<td><xsl:value-of select="county_UA"/></td>
<td><xsl:value-of select="pop_code"/></td>
<td><xsl:value-of select="favourite_instrument"/></td>
<td><xsl:value-of select="bbb"/></td>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="fruit"/></td>
<td><xsl:value-of select="prizes"/></td>
<td><xsl:value-of select="fguk_code"/></td>
<td><xsl:value-of select="fgeu_code"/></td[/HTML]

this displays all the fields data, perfect

now, i have another set of check boxes and radio buttons for the colour for the fields

[HTML] <fieldset>
<legend>Colours 1</legend>
<input type="radio" name="radiobutton1" value="chocolate" />chocolate
<input type="radio" name="radiobutton1" value="forestgreen" />forestgreen
<input type="radio" name="radiobutton1" value="turquoise" />turquoise
<br />
<input type="checkbox" name="checkbox11" value="county_UA" />county_UA
<input type="checkbox" name="checkbox12" value="pop_code" />pop_code
<input type="checkbox" name="checkbox13" value="favourite_instrument" />favourite_instrument
<input type="checkbox" name="checkbox14" value="bbb" />bbb
<input type="checkbox" name="checkbox15" value="id" />id
<input type="checkbox" name="checkbox16" value="fruit" />fruit
<input type="checkbox" name="checkbox17" value="prizes" />prizes
<input type="checkbox" name="checkbox18" value="fguk_code" />fguk_code
<input type="checkbox" name="checkbox19" value="fgeu_code" />fgeu_cod
</fieldset>[/HTML]

so if the user wants the fields or a particular field in a colout you can do so, how do i do this basicaly to any part of the code.

so in another words if the user wants to see these fields ID, FRUIT, PRIZES in the colour turquoise you could choose so, and all these values are stored in sessions.

PHP Code:
    $_SESSION['firsttextbox'] = $_POST['firsttextbox'];
    
$_SESSION['checkbox0'] = $_POST['checkbox0'];
    
$_SESSION['checkbox1'] = $_POST['checkbox1'];
    
$_SESSION['checkbox2'] = $_POST['checkbox2'];
    
$_SESSION['checkbox3'] = $_POST['checkbox3'];
    
$_SESSION['checkbox4'] = $_POST['checkbox4'];
    
$_SESSION['checkbox5'] = $_POST['checkbox5'];
    
$_SESSION['checkbox6'] = $_POST['checkbox6'];
    
$_SESSION['checkbox7'] = $_POST['checkbox7'];
    
$_SESSION['checkbox8'] = $_POST['checkbox8'];
    
$_SESSION['checkbox9'] = $_POST['checkbox9'];
    
$_SESSION['checkbox10'] = $_POST['checkbox10'];
    
$_SESSION['checkbox11'] = $_POST['checkbox11'];
    
$_SESSION['checkbox12'] = $_POST['checkbox12'];
    
$_SESSION['checkbox13'] = $_POST['checkbox13'];
    
$_SESSION['checkbox14'] = $_POST['checkbox14'];
    
$_SESSION['checkbox15'] = $_POST['checkbox15'];
    
$_SESSION['checkbox16'] = $_POST['checkbox16'];
    
$_SESSION['checkbox17'] = $_POST['checkbox17'];
    
$_SESSION['checkbox18'] = $_POST['checkbox18'];
    
$_SESSION['checkbox19'] = $_POST['checkbox19'];
    
$_SESSION['checkbox20'] = $_POST['checkbox20'];
    
$_SESSION['checkbox21'] = $_POST['checkbox21'];
    
$_SESSION['checkbox22'] = $_POST['checkbox22'];
    
$_SESSION['checkbox23'] = $_POST['checkbox23'];
    
$_SESSION['checkbox24'] = $_POST['checkbox24'];
    
$_SESSION['checkbox25'] = $_POST['checkbox25'];
    
$_SESSION['checkbox26'] = $_POST['checkbox26'];
    
$_SESSION['checkbox27'] = $_POST['checkbox27'];
    
$_SESSION['checkbox28'] = $_POST['checkbox28'];
    
$_SESSION['checkbox29'] = $_POST['checkbox29'];
    
$_SESSION['radiobutton'] = $_POST['radiobutton'];
    
$_SESSION['radiobutton1'] = $_POST['radiobutton1'];
    
$_SESSION['radiobutton2'] = $_POST['radiobutton2'];
    
$_SESSION['range1'] = $_POST['range1'];
    
$_SESSION['range2'] = $_POST['range2']; 

is that possible?
 
Old 05-09-2006, 03:40 PM   #2
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Original Poster
Rep: Reputation: 15
hi

this is exactly the desired effect that i need,

basicaly The columns to display mechanism and the columns to colour mechanism are completely different.

You use the columns to display mechanism to choose what columns you want to display, that is it’s one and only purpose.

You then use the columns to colour mechanism to select which column you would like to colour, then the colour you want to make it.

here is the pic:



http://img293.imageshack.us/img293/7974/sas6vn.jpg
 
Old 05-12-2006, 02:07 AM   #3
ruh31
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Ubuntu
Posts: 51

Rep: Reputation: 15
Okay, I will start with ignoring most of what you have written, because I must admit, that it still confuses me a little ...

As I understood you, you just want to be able to give certain columns of a table a specified color.

So for example you could do something like the following form in order to select what color each column should have:

PHP Code:
[...]
echo 
"Column 1: ";
echo 
"<select name=\"color_col1\">";
echo 
"<option value=\"\">None</option>";
echo 
"<option value=\"#0000FF\">Blue</option>";
echo 
"<option value=\"#FFFF00\">Yellow</option>";
echo 
"</select>";
[...] 
And then when creating the table, you could use the following function to dye the columns (just use this function my_td($i) instead of writing <td> for the beginning of each field):

PHP Code:
function my_td($i) {
  
$name "color_col" $i;
  if (!isset(
$_POST[$name]) || $_POST[$name]=="") {
    echo 
"<td>";
  } else {
    echo 
"<td bgcolor=\"" $_POST[$name] . "\">";
  }

So you would just write

PHP Code:
my_td(1); echo "blabla</td>";
my_td(2); echo "blabla</td>"
in order to produce two cells of output.

... hope I could help!
 
Old 05-12-2006, 02:11 AM   #4
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Original Poster
Rep: Reputation: 15
Thumbs up

Quote:
Originally Posted by ruh31
Okay, I will start with ignoring most of what you have written, because I must admit, that it still confuses me a little ...

As I understood you, you just want to be able to give certain columns of a table a specified color.

So for example you could do something like the following form in order to select what color each column should have:

PHP Code:
[...]
echo 
"Column 1: ";
echo 
"<select name=\"color_col1\">";
echo 
"<option value=\"\">None</option>";
echo 
"<option value=\"#0000FF\">Blue</option>";
echo 
"<option value=\"#FFFF00\">Yellow</option>";
echo 
"</select>";
[...] 
And then when creating the table, you could use the following function to dye the columns (just use this function my_td($i) instead of writing <td> for the beginning of each field):

PHP Code:
function my_td($i) {
  
$name "color_col" $i;
  if (!isset(
$_POST[$name]) || $_POST[$name]=="") {
    echo 
"<td>";
  } else {
    echo 
"<td bgcolor=\"" $_POST[$name] . "\">";
  }

So you would just write

PHP Code:
my_td(1); echo "blabla</td>";
my_td(2); echo "blabla</td>"
in order to produce two cells of output.

... hope I could help!


hi

thanks for that ya something on those lines, i'll try and see how far i can get, is it possible for me to ask u on msn or just perfer the thread.
if so just private message me!
thanks for help once more
 
Old 05-12-2006, 02:14 AM   #5
ruh31
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Ubuntu
Posts: 51

Rep: Reputation: 15
I prefer the thread. I am practically never online on MSN, ICQ, or whatever else. So it could take weeks in order to reach me there

And of course it is no problem, if I can I will help!
 
Old 05-12-2006, 02:16 AM   #6
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Original Poster
Rep: Reputation: 15
no worries at and many thanks a gain
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
if two x sessions are running leaving one causes garble display netsurf SUSE / openSUSE 0 12-05-2005 12:55 PM
display garbled (not corrupted) in linux console sessions Erik Garrison Linux - Hardware 1 10-24-2005 07:29 PM
one computer, one display, two X sessions? kapa Mandriva 7 06-14-2004 01:52 PM
lilo hangs when other OS is chosen tsoroka Linux - General 1 02-01-2002 02:28 AM
lilo hangs when other OS is chosen tsoroka Linux - Software 0 01-31-2002 08:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration