airplaneman19
airplaneman19

Reputation: 1159

Entire string not being echoed?

I'm trying to implement the functionality to delete a post on my site if you are the author. I have the part that authenticates whether or not you can delete it down, but my problem is when it echoes the link to delete it.

<div id="postFull" class="postFull">
    <span class="postText"><?php echo stripslashes($text) ?></span><br /><br />
    <span class="metaInfo">...says <a href="profile.php?id=<?php echo $posterID ?>"><i><?php echo $poster ?></i></a> on <i><?php echo $date ?></i></span>
    <?php 
        if($deletable) 
            echo "<span style='align: right;'><a href='post.php?id=$postID&delete=true>Delete</a></span>";
    ?>
</div>

When I view the page, the delete link isn't showing up. After looking at the HTML source in Chrome, I can see that it echos <span style='align: right;'> but nothing after that. What's wrong with my code?

Upvotes: 0

Views: 100

Answers (1)

deceze
deceze

Reputation: 522382

You simply have a problem with invalid HTML. The href attribute is missing a closing ', therefore the browser likely discards the entire element since it can't parse it correctly. Use View Source (the raw source) to confirm what is output, the Inspect Element view is already processed by the browser and does not necessarily represent what your script actually outputs.

Upvotes: 3

Related Questions