passing php variables with javascript?

Discussion in 'Javascript' started by dkirkdrei@yahoo.com, Nov 9, 2006.

  1. Guest

    I am trying to open a small new window using javascript and pass a php
    variable onto the new window and this is really being a pain. I believe

    that this is possible but everything that I have tried so far has not
    worked. The relevant code that I am usiing is below. The problem is the
    variable $aster resides in a cell of a table that displays notes
    pertaining to a specific item and depending on the item the notes could
    change. Each table may have anywhere from 1 to 10 notes and they are
    all different. I had everything working fine opening another window
    without javascript but a smaller window would suffice. As of now, all
    of the notes are the same and it is always the last set of notes in the
    table. Anyone familiar with this? Any help would be greatly
    appreciated.


    <SCRIPT language="JavaScript">
    <!--hide
    function newwindow
    {
    window.open('cust_parts_notes.php?aster=<?print
    ($aster);?>','Notes','width=400,height=400,resizable=yes');
    }
    //-->
    </SCRIPT>
    <tr bgcolor=white><td align="center"><?echo "$qty";?></td><td><?echo
    "$partnum";?></td><td><?echo "$desc1 $desc2"?></td>
    <?
    if ($yes_no == "Y"){
    ?><td><a href="javascript:newwindow'<?print ($aster);?>')"
    title='<?echo "$aster"?>'>Notes</a></td><?
    } else { ?><td>&nbsp;</td><?
    }
    ?>
    </tr>
    <?
    }
    }
    odbc_close($connect);
    ?>
    </body>
    </html>
     
    , Nov 9, 2006
    #1
    1. Advertising

  2. Ruso Guest

    wrote:
    > I am trying to open a small new window using javascript and pass a php
    > variable onto the new window and this is really being a pain. I believe
    >
    > that this is possible but everything that I have tried so far has not
    > worked. The relevant code that I am usiing is below. The problem is the
    > variable $aster resides in a cell of a table that displays notes
    > pertaining to a specific item and depending on the item the notes could
    > change. Each table may have anywhere from 1 to 10 notes and they are
    > all different. I had everything working fine opening another window
    > without javascript but a smaller window would suffice. As of now, all
    > of the notes are the same and it is always the last set of notes in the
    > table. Anyone familiar with this? Any help would be greatly
    > appreciated.
    >
    >
    > <SCRIPT language="JavaScript">
    > <!--hide
    > function newwindow
    > {



    > window.open('cust_parts_notes.php?aster=<?print
    > ($aster);?>','Notes','width=400,height=400,resizable=yes');
    > }
    > //-->
    > </SCRIPT>
    > <tr bgcolor=white><td align="center"><?echo "$qty";?></td><td><?echo
    > "$partnum";?></td><td><?echo "$desc1 $desc2"?></td>
    > <?
    > if ($yes_no == "Y"){
    > ?><td><a href="javascript:newwindow'<?print ($aster);?>')"
    > title='<?echo "$aster"?>'>Notes</a></td><?
    > } else { ?><td>&nbsp;</td><?
    > }
    > ?>
    > </tr>
    > <?
    > }
    > }
    > odbc_close($connect);
    > ?>
    > </body>
    > </html>


    If I understand you correctly, u can use the hidden form element on
    your first page to sotre the data. Then you can submit your form via
    javascript to be able to open a new custom window. And then just use
    php to retrive the hidden field(s) value(s).
     
    Ruso, Nov 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rajive Narain
    Replies:
    0
    Views:
    2,014
    Rajive Narain
    Sep 18, 2009
  2. Nautilus
    Replies:
    2
    Views:
    179
    Nautilus
    Oct 13, 2004
  3. eastcoastguyz
    Replies:
    1
    Views:
    120
    Flamer
    Jul 11, 2006
  4. Replies:
    3
    Views:
    232
    frothpoker
    Sep 4, 2006
  5. q-rious
    Replies:
    7
    Views:
    173
    Thomas 'PointedEars' Lahn
    Aug 24, 2008
Loading...

Share This Page