![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Posts: 4
Rep Power: 0
![]() |
I'm a beginner. Need help!
What I'm trying to do is that... there are 4 letters on the screen : B M T P... and all of them are links. If I click 'B', the 'B' will be displayed with font size=7 and color = 'red'. The other characters will be displayed in font size = 3 and color = black. ((I'm trying to do an address book.)) But when I click B, seems like there's nothing happen. Please help!
Thank you. Here is my code: $FriendName = array (Pink, Bun, Tae, Patty, Tee, Minnie, Pan, Manaw); $ChooseList = array (B, M, T, P); print "<BR><BR>"; for ($i=0; $i<count($ChooseList); $i++) { if($List == $ChooseList[$i]) print "<a href='Exercise3_3Feb06.php3?List=$ChooseList[$i]&NewerList=$List[$i]'><font size=7 color = red>$ChooseList[$i]</font></a>"; else if($NewerList == $ChooseList[$i]) print "<a href='Exercise3_3Feb06.php3?List=$ChooseList[$i]&NerwerList=$List[$i]'><font size=3 color = black>$ChooseList[$i]</font></a>"; print " "; } Something wrong with this? |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Please read the forum's rules/FAQ and a "How to Post..." thread. One should check out a community's practices in order to avoid rudeness. These are HTML pages: they eat whitespace. Code not enclosed in tags is an eyesore.
That said, the internet is a client/server paradigm. One should not attempt to achieve true, timely interactions with the server-side PHP code. I recommend you review HTML and CSS. Many (not all) client-side interactions can be achieved in that way. Javascript (often pooh-poohed) can be used for those that can't, although you may have clients with JS disabled. Incidentally, the font tag has been deprecated. Again, review your CSS.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
As DaWei said, please use [ CODE ] or [ PHP ] tags.
Quote:
[php]$word = 'moo'; $numbers = array(1, 2, 3); // note it's $word, but {$numbers[1]}: print "$word {$numbers[1]}"; // prints "moo 2"[/php] |
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
Couple more things, this only works if you have register_globals ON , which is usually off for good reason
you would need to change $List $_GET['List'] Also you mispelled Newer in the second if statement. Also.. you NewerList doesn't really make sense. To make every other letter agree with that condition you can just use else { //print letter in black here
}NewerList is getting set to List[$i] , but List is set to a single character which brings me to another thing, you should set the characters in your array in quotations to mark they are characters
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi freelance scripts - http://ryanguthrie.com/index.html |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|