• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

php html and css, how to use in the same file

Hi experts,

Im new in php and css and im working on a small project. Im stuck on a coding issue. Here is the scenario: i have two different table layouts defined in css code. Depend on a php variable value one or other css format should be used. here is the code ive made but it gives me error.

<?php
 if ($var==0)
   {
       <table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: 860px;">  
   }
if ($var!=0)
  {
   <table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: auto;">  <!--At this line i got the parsing error-->
  }
?>
<tr>
<td>
....................
.....................
.....................
</tr>
</td>
</table>

Open in new window


Any idea how i can do the css selection according to php variable $var value?
Thank you in advance.
Regards,
Raul
0
raulmonda
Asked:
raulmonda
1 Solution
 
kelvinwkwCommented:
<?php
 if ($var==0)
   {
  ?>
<table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: 860px;">
 <?php
   } else  {
  ?>
   <table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: auto;">  <!--At this line i got the parsing error-->
 <?php
  }
?>
0
 
raulmondaAuthor Commented:
hi kelvinwkw,

I test it and it works fine.
Thank you very much.
Regards,
Raul
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now