Results 1 to 3 of 3

Thread: how we can take $_post variable in javascript code???

  1. #1
    Join Date
    Feb 2009
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question how we can take $_post variable in javascript code???

    Hello all ,

    I have two forms. one in which i will fill value & after submitting

    this $_Post['value'] , this value will go in to the next page.

    But i need this value on next page in my javascript code also .

    when i use this value in javascript by storing it in a variable "abc"

    like :-
    Code:
    var abc="<?php echo $_POST['adult']; ?>";
    
    alert(abc);
    then it shows in alert the script "<?php echo $_POST['adult']; ?>";

    rather than the value of php variable stored .




    please suggest me some solution regarding these so that the JS alert shows

    the value of php variable stored , rather than the php script used .



    Thanks & Regards.
    Last edited by MSK7; 06-26-2009 at 06:55 AM.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    not sure but what if you do it without the quotes

    like

    var abc=<?php echo $_POST['adult']; ?>;

    alert(abc);

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    DD Admin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •