cowboysdude Posted August 23, 2009 Share Posted August 23, 2009 This is what I'm trying to do... grab a variable and if it's true then show the following... <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" } Else {echo (""); } } ?> I can't get it to work.. it just won't load the page. Question is how do I format this to work? Thanks Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/ Share on other sites More sharing options...
Zoofu Posted August 23, 2009 Share Posted August 23, 2009 <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" }else { echo " "; } } ?> And I think .$vid1. needs to be ".$vid1." Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904691 Share on other sites More sharing options...
oni-kun Posted August 23, 2009 Share Posted August 23, 2009 What? That's code is written poorly.. look up the echo and you'll note the construct formatting you should be doing with your if statements etc. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>' } Else { echo ""; //No need for this Else really.. } ?> Should work.. Note you can only store double quotes ( " ) in a single quote.. such as echo ' This " are "" quotes "" '; , anything else will fail. Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904700 Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 What? That's code is written poorly.. look up the echo and you'll note the construct formatting you should be doing with your if statements etc. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>' } Else { echo ""; //No need for this Else really.. } ?> Should work.. Note you can only store double quotes ( " ) in a single quote.. such as echo ' This " are "" quotes "" '; , anything else will fail. OH I know it's bad that's why I was asking for help..LOL Thank you!! <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" }else { echo " "; } } ?> And I think .$vid1. needs to be ".$vid1." Great idea ... still not working.. But Thank you!!! Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904756 Share on other sites More sharing options...
oni-kun Posted August 24, 2009 Share Posted August 24, 2009 Try this code, forgot to add the ;.. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } ?> Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904760 Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Try this code, forgot to add the ;.. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } ?> Well the page now loads the overlay doesn't fire... Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904775 Share on other sites More sharing options...
EchoFool Posted August 24, 2009 Share Posted August 24, 2009 Does the page source show the overlay div echo'd ? if not then the if statement is failing... Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904781 Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Does the page source show the overlay div echo'd ? if not then the if statement is failing... I would say not.. this is all it's showing... <!-- overlays for videos --> </div> </div> </div> </div> </div> </div> Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904791 Share on other sites More sharing options...
oni-kun Posted August 24, 2009 Share Posted August 24, 2009 Try this then: <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } else { die('$v1 is NOT set'); } ?> That'll stop the script if $v1 isn't set.. therefor not letting your IF statement echo anything, for testing purposes. If it's not echo'ing, then obviously your =1 isn't working.. Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-904801 Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Ok I got $v1 - 10 set.. NOW what is wrong with the following statement because I am just not seeing it... <?php If ($v1=="1") { echo '<p><button rel="#overlay1">'. $title1.'</button></p>' } ?> But this is NOW what's stopping the page from loading.. hummmmm Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-905419 Share on other sites More sharing options...
cowboysdude Posted August 25, 2009 Author Share Posted August 25, 2009 Ok got it!! Here it is.. <?php If ($v1=="1") { echo '<button rel="#overlay2">'. $title1.'</button>'; } ?> Many Thanks for all your help!! I'm marking this one solved!! Link to comment https://forums.phpfreaks.com/topic/171551-solved-php-question-with-html/#findComment-905795 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.