www.webdeveloper.com
Results 1 to 3 of 3

Thread: beginner format question

  1. #1
    Join Date
    Jan 2009
    Posts
    16

    beginner format question

    Hi,
    how can I change the format of a cell with php?
    In plain English something like;

    If ($i==10)
    {
    replace <td> with <td class="MyClass">
    }

    thanks for any help.

  2. #2
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    Why not:

    PHP Code:
    If ($i==10)
    {
    echo 
    "<td class='MyClass'></td>" ;
    }else{
    echo 
    "<td>blah</td>";


  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,527
    I sometimes use this approach:
    PHP Code:
    $class = ($i == 10) ? " class='MyClass'" "";
    echo 
    "<td$class>blah</td>\n"
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles