Rushy Posted November 12, 2007 Share Posted November 12, 2007 Hey all, another quick question. I need to add a number to <book></book> every time this piece of code loops. I.e. <book1></book1> then <book2></book2> echo fwrite($file,"<customer><fname>$_GET[fName]</fname><lname>$_GET[lName]</lname><email>$_GET[Email]</email></customer>"); foreach($_COOKIE as $cookie){ echo fwrite($file, "<books><book>\"$cookie\"</book></books>"); } Could someone please tell me how to do this? I researched it but I can't seem to get it to work Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 12, 2007 Share Posted November 12, 2007 echo fwrite($file,"<customer><fname>$_GET[fName]</fname><lname>$_GET[lName]</lname><email>$_GET[Email]</email></customer>"); foreach($_COOKIE as $cookie){ ++$cnt;// set a counter echo fwrite($file, "<books".$cnt."><books".$cnt.">\"$cookie\"</books".$cnt."</books".$cnt.">"); } Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 12, 2007 Author Share Posted November 12, 2007 Cheers!! Much appreciated. Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 12, 2007 Share Posted November 12, 2007 youre welcome friend ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.