Jump to content

[SOLVED] Php question with html...


cowboysdude

Recommended Posts

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

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.

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!!!

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...

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>

 

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..

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.