Calling java script in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Dormilich
    replied
    Originally posted by dheerajjoshim
    Its a string...
    it ain’t even a string, it’s NULL because you assign a set of invalid characters. (strings are wrapped in ' (single quotation mark or apostrophe) or " (double quotation mark) not backticks (these are used in SQL).

    but of course you can use PHP to print JS code…

    Leave a comment:


  • Dheeraj Joshi
    replied
    Its a string...

    I am sorry..

    So can i use java script in PHP?

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    Originally posted by dheerajjoshim
    Code:
    $res = `php myfile.php`;
    how is that an integer?

    Leave a comment:


  • Dheeraj Joshi
    replied
    $res is integer by the way.

    So isnt there a technique to pop up a window in PHP code?

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    Originally posted by dheerajjoshim
    Technically it should pop up a window of alert.
    No, it should give "No choice". if you do var_dump($res); you’ll see why. besides, even if $res would be a string it still would match the default chioce.

    Originally posted by dheerajjoshim
    this will give value 1.
    how do you come to that conclusion?

    Leave a comment:


  • Dheeraj Joshi
    started a topic Calling java script in PHP

    Calling java script in PHP

    I have this code.


    Code:
    <html>
    <body>
    <?php
    
    $res = `php myfile.php`;
    
    switch($res)
    {
    	case 1: "<scriptlanguage=javascript> 
    		alert('Blah Blah')
    		</script>";
    		break;
    	case 2: echo "Choice 2";
    		break;
    	case 3: echo "Choice 3";
    		break;
    	default:echo "No choice";
    		break;
    }
    
    ?>
    </body>
    </html>
    Technically it should pop up a window of alert.

    But it wont.
    Code:
    echo $res;
    this will give value 1.

    Whats wrong with it.?

    Regards
    Dheeraj Joshi
Working...