Web Analytics Made Easy -
StatCounter Parsing PHP - CodingForum

Announcement

Collapse
No announcement yet.

Parsing PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parsing PHP

    Sort of an elaboration on my last question...

    If I have the following code to open up a JavaScript pop up window

    Code:
    <a href="javascript:void(0)"onclick="window.open('/admin/forms/products.php','welcome','width=400,height=400,menubar=no,status=yes,location=yes,toolbar=no,scrollbars=no')">
    Edit</a>
    Is it possible for me to include some PHP variable within the link in order to load the window when it opens

    Code:
    <a href="javascript:void(0)"onclick="window.open('/admin/forms/products.php',<? $name="Bob Smith";$age="32" ?>,'welcome','width=400,height=400,menubar=no,status=yes,location=yes,toolbar=no,scrollbars=no')">
    Edit</a>
    And then the products.php code as below when it opens...

    Code:
          <table>
            <tr>
              <td width="150"><? $name ?> is <? $age ?> years of age</td>
            </tr>
          </table>
    I don't want to use $_GET or anything, other wise i have to make the initial link a form in order to send the additional info and then call it and search my database first.

    Can the above be done, if so, where am I going wrong?

    All the help is appreciated!


  • #2
    No. You would have to pass the info as a query string and then use $_GET.

    But why do you say "i have to make the initial link a form in order to send the additional info"???

    Why can't you just do
    Code:
    <a href="javascript:void(0)"
      onclick="window.open('/admin/forms/products.php?name=Bob+Smth&age=32',
                           'welcome',
                           'width=400,height=400,menubar=no,status=yes,location=yes,toolbar=no,scrollbars=no')">
    Edit</a>
    And then using $_GET["name"] will give you "Bob Smith", etc. Don't see why this has to involve a <FORM>, at all.
    Be yourself. No one else is as qualified.

    Comment

    Working...
    X