LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-09-2006, 02:10 PM   #1
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Rep: Reputation: 15
fwrite in another fwrite?


hi all

at the momeny i have this statement, which writes:

PHP Code:
if (isset($_SESSION['checkbox10'])) {
fwrite($handle,'<td><xsl:value-of select="fgeu_code"/></td>'."\n");

this writes:

[HTML]<td><xsl:value-of select="county_UA"/></td>[/HTML]

i want be able to add back colour to the td and i have this so far which writes the statement:

PHP Code:
if (isset($_SESSION['radiobutton1']))
{
  if (
$_SESSION['radiobutton1'] == 'chocolate')
     
$colour "#D2691E";
   elseif (
$_SESSION['radiobutton1'] == 'forestgreen')
     
$colour "#228B22";
   elseif (
$_SESSION['radiobutton1'] == 'turquoise')
      
$colour "#00DED1";
}
if (isset(
$_SESSION['checkbox11']))
 
fwrite($handle,"<td bgcolor=\"$colour\"><xsl:value-of select=\"county_UA\"/></td>"."\n"); 
this writes:

[HTML]<td bgcolor="#D2691E"><xsl:value-of select="county_UA"/></td>[/HTML]

i want to be able just to modify the exisiting line above but with out writing the entire code so it will only add the [HTML]bgcolor="#D2691E[/HTML]

so it will look like something like this i think:

PHP Code:
fwrite($handle,<td bgcolorfwrite($handle,"$colour\"><xsl:value-of select=\"county_UA\"/></td>"."\n"); 
so it will write the line and if the colour is requested it will add the bkground colour.

is that possible?

here is a picture to see what i mean!

http://img166.imageshack.us/my.php?i...titled28eq.gif



thanks all

Last edited by ati; 05-09-2006 at 02:30 PM.
 
Old 05-11-2006, 03:16 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
So you want to replace <TD> by <TD bgcolor="$bgcolor">. Have a look at string replace functions. Not sure which one will do, maybe substr_replace
 
Old 05-11-2006, 03:25 AM   #3
ati
Member
 
Registered: Oct 2005
Location: london
Distribution: fedora 4
Posts: 61

Original Poster
Rep: Reputation: 15
hi

ya ya something like that

thanks i'll have a look
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
what could cause this fwrite() to seg fault? hedpe Programming 11 02-12-2006 11:02 PM
fwrite() doe not move pointer, why? realos Programming 4 12-08-2005 01:48 PM


All times are GMT -5. The time now is 12:01 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration