I have a page where I’m using a foreach loop to cycle through users posts. The code for the text posts are rendering just fine, but what I don’t get is a weird glitch in the video submissions.
here is the code I wrote:
[code=php]
if($post[‘format’]==’vid’){ ?>
<li class=’vid’>
<video class=’post-video’ height=’300′ width=’400′ controls>
<source src='<?php echo $post[‘entry_path’]; ?>’></source>
</video>
<br>Posted by: <?php echo $post[‘username’]; ?>
<?php if(isset($_COOKIE[‘goodact’]) && $u_logged!=$post[‘username’]){ ?>
<form action=’scripts/vote.php?member=<?php echo $post[‘username’]; ?>&logged=<?php echo $u_logged; ?>&page=<?php echo $page; ?>’
method=’post’>
<input type=’hidden’ name=’entry_id’ value='<?php echo $post[‘id’]; ?>’>
<?php if(!in_array($post[‘id’], explode(“,”,$votes))){ ?>
<input type=’submit’ value=’GOOD CATCH!’>
<?php }else{ ?>
YOU VOTED THIS POST A GOOD CATCH.
<?php } ?>
</form>
<?php } ?>
</li>
<?php } //more code
but here is the code rendered in the browser when a user is logged in. Keep in mind the difference between the following two video items:
[CODE]
<li class=”vid”>
<div class=”RDVideoHelper” style=”position: absolute; z-index: -1; display: block;”><object class=”RDVideoObject” type=”application/x-rn-downloaderhtml5videoshim-plugin” src=”http://localhost/goodact/entries/videos/thepulsiphyer/Patterns%20of%20Light%20part%20II.mp4″ width=”400″ height=”300″ data-offsetleft=”143″ data-offsettop=”424″></object></div><video class=”post-video” height=”300″ width=”400″ controls=””>
<source src=”entries/videos/thepulsiphyer/Patterns of Light part II.mp4″>
</video>
<br>Posted by: thepulsiphyer
<input type=”hidden” name=”entry_id” value=”6″>
<input type=”submit” value=”GOOD CATCH!”>
</li>
<li class=”vid”>
<div class=”RDVideoHelper” style=”position: absolute; z-index: -1; display: block;”><object class=”RDVideoObject” type=”application/x-rn-downloaderhtml5videoshim-plugin” src=”http://localhost/goodact/entries/videos/nadiene38/hour%20by%20hour%20lds.org.mp4″ width=”400″ height=”300″ data-offsetleft=”143″ data-offsettop=”787″></object></div><video class=”post-video” height=”300″ width=”400″ controls=””>
<source src=”entries/videos/nadiene38/hour by hour lds.org.mp4″>
</video>
<br>Posted by: nadiene38 <form action=”scripts/vote.php?member=nadiene38&logged=notdross99&page=index” method=”post”>
<input type=”hidden” name=”entry_id” value=”7″>
<input type=”submit” value=”GOOD CATCH!”>
</form>
</li>
what’s wrong with the first list item? why is the form showing up for the second one but not the first? I would think that since the <input> element in the first video appears that means the first if(isset($_COOKIE[‘goodact’]) && $u_logged!=$post[‘username’]) has passed. But since the <form> element didn’t render in the first one, that would mean that initial condition didn’t pass right? the code seems to be contradicting itself here… so confused