write line using php if statement and sessions?
hi all
here are my sessions: PHP Code:
here is my xsl using the fwrite: Code:
fwrite($handle,'<td><xsl:value-of select="bbb"/></td>'."\n"); all together i have any fiels do the user could choose bewteen 1-9 fields to be displayid so thats 1-9 lines, can some one please tell me if thats possible. thanks s thanks :injured: |
i have tried something like this:
but it does nothing PHP Code:
PHP Code:
thanks |
I'm not certain I understand what you are trying to do however, it looks as if you have a form with a number of checkboxes. You need to check to see if the checkbox has been set. You can do this as follows:
PHP Code:
|
i have managed to find the solution,
if (isset($_SESSION['checkbox2'])) { fwrite($handle,'<td><xsl:value-of select="county_UA"/></td>'."\n"); } if (isset($_SESSION['checkbox3'])) { fwrite($handle,'<td><xsl:value-of select="pop_code"/></td>'."\n"); } is it possible to so the same if your using the same value to make a table for example instead of a static table rows <tr><th>county_UA</th><th>pop_code</th><th>favourite_instrument</th> <th>bbb</th><th>id</th><th>fruit</th><th>prizes</th><th>fguk_code</th> <th>fgeu_code</th></tr> you would do if this value is found on the session than print it like this <th>county_UA</th>, exacly the same solution i found but with the fields. thanks |
Yes you'd want to do something like the following:
PHP Code:
PHP Code:
|
hi graemef
thanks for that and ur effort i will try and let you know |
hi greamf
many many thanks thats working great, im trying to do something similar this time but with radio buttons but it would write this value in the xsl: [HTML]<xsl:sort select="pop_code"/>[/HTML] but instead of pop_code it will show what ever the user chose out of 20 radiobuttons or choices but it could only by one obviously out of the 20. here is the php for that: PHP Code:
i had a try but nothing again :( PHP Code:
:newbie: |
You idea looks alright, you can do something like this:
PHP Code:
|
all my buttons have the same id
here they are: [HTML]<div> <fieldset> <legend>Order By Mechanism - (Sortfield)</legend> <input type="radio" name="radiobutton" value="none" />none <input type="radio" name="radiobutton" value="id" />id <input type="radio" name="radiobutton" value="county_UA" />county_UA <input type="radio" name="radiobutton" value="pop_code" />pop_code <input type="radio" name="radiobutton" value="favourite_instrument" />favourite_instrument <input type="radio" name="radiobutton" value="bbb" />bbb <input type="radio" name="radiobutton" value="id" />id <input type="radio" name="radiobutton" value="fruit" />fruit <input type="radio" name="radiobutton" value="prizes" />prizes <input type="radio" name="radiobutton" value="fguk_code" />fguk_code <input type="radio" name="radiobutton" value="fgeu_code" />fgeu_code <br /> <input type="radio" name="radiobutton" value="none" />none <input type="radio" name="radiobutton" value="id" />id <input type="radio" name="radiobutton" value="county_UA" />county_UA <input type="radio" name="radiobutton" value="pop_code" />pop_code <input type="radio" name="radiobutton" value="favourite_instrument" />favourite_instrument <input type="radio" name="radiobutton" value="bbb" />bbb <input type="radio" name="radiobutton" value="id"/>id <input type="radio" name="radiobutton" value="fruit" />fruit <input type="radio" name="radiobutton" value="prizes" />prizes <input type="radio" name="radiobutton" value="fguk_code" />fguk_code <input type="radio" name="radiobutton" value="fgeu_code" />fgeu_code </fieldset> </div[/HTML] so the code for this should look like this: PHP Code:
what do you think? thanks |
i have tried both exmples and it results like this:
if i use this: PHP Code:
[HTML]<xsl:sort select="none"/>[/HTML] and i use this my big code it produuces all the lines but not one |
hi
i managed to find the solution for the radiobutton problem thanks for looking i do have another though and is to do with my first problem, is to colour the fields from the radio buttons. so we have these checkboxes to choose the values that we want coloured here are the check boxes and radio buttons: [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 i want any of those values to be coloured by the above colours, so if you tick county_ua and than choose it will colour forestgreen. is that clear? |
|
If you just want to dispay the selected items in a different colour then break you code into two parts.
1) Select the colour: PHP Code:
PHP Code:
|
hi graemef
i think were close but it didnt work, let me clarify, so far from the first set of check boxes when the user ticks it writes these lines from this code offcourse using the sessions: PHP Code:
[HTML]<table id="tab" border="5" > <tr bgcolor="#9acd32"> <th>county_UA</th> <th>pop_code</th> <th>favourite_instrument</th> <th>bbb</th> <th>id</th> <th>fruit</th> <th>prizes</th> <th>fguk_code</th> <th>fgeu_code</th> </tr> <xsl:for-each select="newdata/data1"> <tr> <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> </tr>[/HTML] that basicaly writes to the xsl file to display the fields and data from the xml. (this works perfect) but in another set of check boxes that i have that you saw in my last post, i want to give the user the ability to colour the field's rows if they like by the radio buttons and the field that the want coloured. basicaly this should output some thing like this: [HTML]<td bgcolor="#ff00fd"><xsl:value-of select="county_UA"/></td>[/HTML] and i think we are very close as we have an if statement that handle the colour issue is just a matter of fwrite the code approbiatly in the xsl sheet. is that clearer you think? thanks again for your help and time:rolleyes: |
so it need basicaly to look like this:
with out over writing the users first request from the first set of check boxes but just colour the fields that you want coloured. [HTML]<tr> <td bgcolor="#ff00fd"><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="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> </tr> [/HTML] no like this because it will double up the fields values so it will looke like county_ua west west (with colour) in code will look like: [HTML]<tr> <td bgcolor="#ff00fd"><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="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> </tr> <tr> <td bgcolor="#ff00fd"><xsl:value-of select="county_UA"/></td> </tr>[/HTML] i dont know how this will be achieved but ur very close and i,m tampering with the code as we speak. :newbie: |
All times are GMT -5. The time now is 09:21 AM. |