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

Link to comment
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.

 

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
Share on other sites

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
Share on other sites

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
Share on other sites

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