Jump to content

[SOLVED] echo problem with double quotes " "


sebastiaandraaisma

Recommended Posts

Hi,

I try to echo out the following:

if ($timezone != "NULL") { //If a timezone is available for this country, show time
echo
"<tr>
<td><span class="style3"> Local time in echo ".$time."</span> 
</td>
</tr>"
}

I get an error because of the double quotes in class="style3"

 

I tried the following:

<?php
if ($timezone != "NULL") { //If a timezone is available for this country, show time
echo
?>
<tr>
<td><span class="style3"> Local time in <?php echo $time?></span> 
</td>
</tr>
<?php
}
?>

But still got an error.

 

My intention is to show the table cell only when var $timezone has been defined.

 

I read trough my MySQL & PHP bible but could not find the answer :)

All help is apriciated.

 

Kind regards,

Sebas.

Link to comment
Share on other sites

My personal preference is to jump in and out of php when needed like in the first example

 

<?php

if ($timezone != "NULL") { //If a timezone is available for this country, show time

?>

<tr>

<td><span class="style3"> Local time in echo  <?=$time ?></span>

</td>

</tr>

 

<?php } ?>

 

As long as everything else above and below this snippet of code is correct, this method should work just fine.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.