JavaScript and php-variable

Discussion in 'JavaScript' started by J.Winnfield, Feb 7, 2010.

  1. #1
    How should I do this:
    if ("<?= $php_variable ?>" =="something"){/*Do this*/}
    else {/*do that*/}
    ?
    thanks!
     
    J.Winnfield, Feb 7, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    I think you have to do like this:

    
    <?php if ($php_variable=="something"){ ?>/*Do this*/<?php }
    else { ?>/*do that*/<?php } ?>
    
    Code (markup):
     
    s_ruben, Feb 8, 2010 IP
  3. nadiralishah_webexpert

    nadiralishah_webexpert Guest

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    seems like you gave the answer urself...
     
    nadiralishah_webexpert, Feb 8, 2010 IP