js varaible convert in php

Discussion in 'PHP' started by fiza23, May 19, 2009.

  1. #1
    i have a js function which is called in onchnge event of dropdown list
    function get_values()
    {
    alert('enter function');
    var pcode=document.getElementById('p_code').value;

    var b = "<?=get_value_php();?>";
    alert(b);


    }
    i want to pas pcode variable to get_value_php function which is in php and i want to do it before the form is submit.plz do reply me soon if anybody had any idea of it
     
    fiza23, May 19, 2009 IP
  2. d4xDragon

    d4xDragon Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi

    i think you can not do that. to achieve this you should use Ajax.

    thanks
    Dragon
     
    d4xDragon, May 19, 2009 IP
  3. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #3
    You can just echo the string literal or variable.
     
    Kaizoku, May 20, 2009 IP
  4. easydolla

    easydolla Peon

    Messages:
    403
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <?$_GET['value'];?> ?

    *untested*
     
    easydolla, May 20, 2009 IP
  5. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #5
    your code of :
    <?=get_value_php();?>

    is wacky. =get_value_php() ?????
     
    ezprint2008, May 21, 2009 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    The <?= get_value_php(); ?> is shortform for <?php echo get_value_php(); ?> and perfectly valid - although I don't know why you'd want to echo a function, but that's a whole different matter.
     
    PoPSiCLe, May 21, 2009 IP