SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy for loop to retrieve info and write approbiate line of code?

    hi all

    here are all my cookies and sessions: there are many more

    PHP Code:
        $_SESSION['checkbox2'] = $_POST['checkbox2'];
        
    $_SESSION['checkbox3'] = $_POST['checkbox3'];
        
    $_SESSION['checkbox4'] = $_POST['checkbox4'];

    $_COOKIE['checkbox0'] = $_POST['checkbox0'];
        
    $_COOKIE['checkbox1'] = $_POST['checkbox1'];
        
    $_COOKIE['checkbox2'] = $_POST['checkbox2']; 


    i am retrieving info from page 1 to page 2 using cookies and sessions, so for example i have these check boxes: there also many more check boxes

    HTML Code:
    <input type="checkbox" name="checkbox2" value="1st_name" />1st_name
    		<input type="checkbox3" name="checkbox3" value="2nd_name" />2nd_name
    		<input type="checkbox4" name="checkbox4" value="3rd_name" />3rd_namet
    once ticked it will show their values on the next page which page2.php.

    i.e:

    Micheal Jordan Junior

    or if one box ticked depending which one it will only show

    i.e Micheal or Jordan or Junior

    from these values that are saved in the cookies or sessions, i think sessions as it will be easier i want to use a FOR a loop and IF statement to say if you see this value write this line to file
    which is in my xsl

    i.e like: here is my xsl so far:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <link rel="stylesheet" type="text/css" href="first.css"/>
    <link rel="stylesheet" type="text/css" href="second.css"/>
    </head>
    <body id="contents">
    
    <h1>Joint Wes_ica Tables</h1>
    <table id="tab" border="5">
    <tr><th>1st_name</th><th>2nd_name</th><th>3rd_name</th>
    
    <xsl:for-each select="newdata/data1">
    <xsl:sort select="1st_name"/>
    <tr>
    <td><xsl:value-of select="1st_name"/></td>
    <td><xsl:value-of select="2nd_name"/></td>
    <td><xsl:value-of select="3rd_name"/></td>
    
    </tr>
    </xsl:for-each>
    
    </table>
    
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    and this is sorting by first name and displaying all the fields, but i want some times to write a line to only display that particular field and the same sort for example.



    can some one please help me with this if its possible, thanks for your time and effort.





    so basicaly in another words:

    The information that are retreived from the first page and then saved into cookis or sessions needs to be used on page 3 to choose what elements of the XSL style sheet are to be written to the file. For example on the third page you would run an if statement to see if the display 1st_name box was ticked, if not then dont write any of the lines relating to the 1st_name.

    thanks
    Last edited by benq; May 7, 2006 at 01:41. Reason: added more info


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •