Jump to content


Photo

Starting and Ending Code In Different PHP Scripts?


  • Please log in to reply
1 reply to this topic

#1 g1c9

g1c9
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 February 2006 - 02:47 AM

Hey,

I am trying to display html between php code brackets if and only if a variable is set. For example:


<?php 

if ($some_var == 1) { echo(' 

?> 

if some_var is equal to 1 then this will display, otherwise it wont!

<?php 

'); }

?>

Is this even possible? Please help me achieve this!

Thanks in advance,

Cameron

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 February 2006 - 02:54 AM

<?php
.....
if ($somevar==1) {
?>
<table><tr><td>
Look, Ma. Just html here
</td>
</tr>
</table>
<?php
}
// some more php code

?>

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users