php - CSS class not getting reflected in the table -


i have values in table on upon click want set particular class , navigate page. table looks this:

    <?php // form page file name if($content_type == "")  {     $content_type = "wtc";   } ?>  <table border='0' width='250' class='navigation'>     <tr>         <td align='left' valign='right' class=<?php if($content_type == "wtc") echo 'active'; ?>><a href='?page=wtc'>create wtc server</a></td>     </tr>     <tr>         <td align='left' valign='right' class=<?php if($content_type == "rap") echo 'active'; ?>><a href='?page=rap'>create rap</a></td>     </tr>     <tr>         <td align='left' valign='right' class=<?php if($content_type == "lap") echo 'active'; ?>><a href='?page=lap'>create lap</a></td>     </tr>     <tr>         <td align='left' valign='right' class=<?php if($content_type == "import") echo 'active'; ?>><a href='?page=import'>import services</a></td>     </tr>     <tr>         <td align='left' valign='right' class=<?php if($content_type == "export") echo 'active'; ?>><a href='?page=export'>export services</a></td>     </tr> </table> 

here thing is navigating page class not set on value when clicked on.

please suggest solution. in advance.

you need before @ page value $_get array

// read page parameter (if exists) $content_type = @$_get['page'];  // it's better sanitize bit user input $content_type = htmlspecialchars($content_type);  if ($content_type == "")  {     $content_type = "wtc";   } 

since when click you're passing page parameter querystring


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -