Solved

Conditional Formatting in Dreamweaver Table

Posted on 2010-08-23
10
698 Views
Last Modified: 2013-12-13
I am using Dreamweaver to create a "Dynamic" information table.  It is setup as a repeat region and pulls data from a MySQL database.  One of the cells of data contains the values "Hot" or “Medium" or “Cool"  The user decides when they enter the data.  This is held in a dropdown menu.  I would like to highlight the row that has "Hot" red. My table of data is as follows

First Name    Last Name    Etc    Etc   Hot
So this row needs to be highlighted red.

I can do this in Access but how can I do it in Dreamweaver or CSS or something else?
Thanks
0
Comment
Question by:napsternova
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501338
Do you want it to highlight red when it pulls an existing row from the database, when you user selects it as a new entry, or both?
0
 

Author Comment

by:napsternova
ID: 33501419
Hmmm, both would be impressive but ultimately the row in the "report" table.  I have a couple CSS scripts already attatched.
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501456
Can you post the code that repeats the result row?
0
 

Author Comment

by:napsternova
ID: 33502515
<?php do { ?>
              <tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
                <td><input type="checkbox" name="kt_pk_Leads" class="id_checkbox" value="<?php echo $row_Recordset1['LeadID']; ?>" />
                  <input type="hidden" name="LeadID" class="id_field" value="<?php echo $row_Recordset1['LeadID']; ?>" /></td>
                <td><div class="KT_col_LeadFirstName"><?php echo KT_FormatForList($row_Recordset1['LeadFirstName'], 20); ?></div></td>
                <td><div class="KT_col_LeadLastName"><?php echo KT_FormatForList($row_Recordset1['LeadLastName'], 20); ?></div></td>
                <td><div class="KT_col_ContactLevel"><?php echo KT_FormatForList($row_Recordset1['ContactLevel'], 20); ?></div></td>
              </tr>
              <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
0
 

Author Comment

by:napsternova
ID: 33504588
Should I post something else?  
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33504626
Sorry, had that nagging "day job" to tend to... :)

what does <?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?> look like in your CSS?
0
 

Author Comment

by:napsternova
ID: 33505433
Pretty sure that represents alernating row colors, white for the odd and gray for the even.  The hightlight (rollover) color is green.  Day job?  Yeah they tend to get in the way.  :)
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33507978
How familiar with PHP are you? It would appear from the code that you are probably just using the drag/drop functionality of Dreamweaver.

I ask, because I would suggest putting some PHP conditionality into the TR that points to conditional CSS, and didn't know how detailed to be...
0
 

Author Comment

by:napsternova
ID: 33510945
wmcdon7160,
PHP I can handle but CSS not so much.  I have been using the original version of the Adobe toolbox because it works really well.  It does seem to add a lot of extra code but it generates forms and tables that are really clean looking.  I use the Conditional functionality in MS Access all the time but never on the web.  This would be a great tool I can use for many things, like checking dates and sending reminders, highlighting fields when a certain date comes around, highlight table rows to bring attention, etc.  I would like to understand how to do this.  If I should read up on CSS I can do that too, and sounds like I probably should.
Thanks,
Jeff
0
 
LVL 3

Accepted Solution

by:
wmcdon7160 earned 250 total points
ID: 33511613
Make a new CSS class called "hot", or whatever.
It will look a lot like the KT_EVEN class.

Then add an IF statement (or DO WHILE) in the <tr> code.
I would try something like the following:
[it's separated on different lines for clarity]


<tr class="
<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>
<?PHP IF ($row_Recordset1['ContactLevel'] == "hot") 
  {echo " hot";} ?>
">

Open in new window

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now