SilentQ-noob- Posted July 17, 2007 Share Posted July 17, 2007 On one page, named words.php, the person is asked to enter four words and hit submit- this then posts it to a new page. On this form - words_process.php, the words are separated and ordered one on top of the other- what I also want to do, but cant, is give each word a different colour. $worddivide = explode(" ", $_POST['words']); echo $worddivide[0]."<br />"; echo $worddivide[1]."<br />"; echo $worddivide[2]."<br />"; echo $worddivide[3]."<br />"; make first word blue, second red for example. Any help would be greatly appreciated. THANKS! -NOOB- Link to comment https://forums.phpfreaks.com/topic/60457-solved-adding-colour-help/ Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 hmm try <style type="text/css"> <!-- .style1 {color: #000099} .style2 {color: #FF0000} --> </style> <? $worddivide = explode(" ", $_POST['words']); for ($ctr=0;$ctr<=count($worddivide);$ctr++) { echo "<span class='style".$ctr."'>".$worddivide[$ctr]."<br /></span>"; } ?> hope that helps ;D Link to comment https://forums.phpfreaks.com/topic/60457-solved-adding-colour-help/#findComment-300720 Share on other sites More sharing options...
SilentQ-noob- Posted July 17, 2007 Author Share Posted July 17, 2007 Made my day- Thanks bro Link to comment https://forums.phpfreaks.com/topic/60457-solved-adding-colour-help/#findComment-300727 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.