Current location: Hot Scripts Forums » Programming Languages » PHP » for loop to retrieve info and write approbiate line of code?


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

Reply
  #1 (permalink)  
Old 05-07-06, 04:45 AM
benq benq is offline
Newbie Coder
 
Join Date: May 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
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

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 Christian; 05-07-06 at 12:26 PM. Reason: No [HTML][/HTML] tags yet! Lookin forward to vB 3.5!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 07:11 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.