link to a child window inside a php tag?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    link to a child window inside a php tag?

    this is my update link.
    Code:
    <?php
    ...
    ...
    ...
    <a href='updatestatus.php?id=$id'>Update</a>
    ?>
    when i click the update link,updatestat us page should be open in a child window? how its Possible?
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Simplest version: (recommended)
    - Right-click -> Open in new tab :)

    Slightly less simple version:
    - <a href="test.php" target="_blank" >

    Complex version: (not recommended!)
    - <a href="javascrip t:void(0);" onclick="window .open('test.php ')">


    The reason why I recommend the manual version is because you really should try not to force your users to do things like open links in new windows. It should be their call whether they want it in a new window or not.

    But then again, you may have an excellent reason why you want to force their hand, in which case I would recommend the second method. The target attribute will be "practicall y" equivalent to the JavaScript version in most browsers. That is; they will open both in a new tab rather than in a new window.

    You can, however, use the window.open function to customize how the window will be displayed, so if you need that sort of functionality you should look into that.

    Comment

    • impin
      New Member
      • Jul 2010
      • 127

      #3
      Originally posted by Atli
      Simplest version: (recommended)
      - Right-click -> Open in new tab :)

      Slightly less simple version:
      - <a href="test.php" target="_blank" >

      Complex version: (not recommended!)
      - <a href="javascrip t:void(0);" onclick="window .open('test.php ')">


      The reason why I recommend the manual version is because you really should try not to force your users to do things like open links in new windows. It should be their call whether they want it in a new window or not.

      But then again, you may have an excellent reason why you want to force their hand, in which case I would recommend the second method. The target attribute will be "practicall y" equivalent to the JavaScript version in most browsers. That is; they will open both in a new tab rather than in a new window.

      You can, however, use the window.open function to customize how the window will be displayed, so if you need that sort of functionality you should look into that.
      this is my code... plz help.
      Code:
      <?php
      print "<tr>
      <td>$cname</td>
      <td><a href='mailto:$email'>$email</td>
      <td>$qual</td>
      <td>$skills</td>
      <td><img src='images/download.gif'>&nbsp;<a href='download.php?id=$filename'>$filename</a></td>
      <td><img src='images/email.png'>&nbsp;<a href='mailto:'>Forward</a></td>
      <td><img src='images/update.png'>&nbsp;<a href='updatestatus.php?id=$id'>Update</a></td>
      </tr>";
      ?>
      /
      i want to open a small child window when i click the update link...
      what u have suggested is not working inside the php print statement..... its shows parse error.
      Last edited by Atli; Aug 2 '10, 05:08 AM.

      Comment

      • impin
        New Member
        • Jul 2010
        • 127

        #4
        Code:
        <?php
        print "<tr>
        <td>$cname</td>
        <td><a href='mailto:$email'>$email</td>
        <td>$qual</td>
        <td>$skills</td>
        <td><img src='images/download.gif'>&nbsp;<a href='download.php?id=$filename'>$filename</a></td>
        <td><img src='images/email.png'>&nbsp;<a href='mailto:'>Forward</a></td>
        <td><img src='images/update.png'>&nbsp;<a href='updatestatus.php?id=$id'>Update</a></td>
        </tr>";
        ?>

        Comment

        • impin
          New Member
          • Jul 2010
          • 127

          #5
          how to create a child window in php?

          i want to open a child window when i click the update link which is inside the php print statment...

          the code is

          Code:
          print "<tr>
          <td>$cname</td>
          <td><a href='mailto:$email'>$email</td>
          <td>$qual</td>
          <td>$skills</td>
          <td><img src='images/download.gif'>&nbsp;<a href='download.php?id=$filename'>$filename</a></td>
          <td><img src='images/email.png'>&nbsp;<a href='mailto:'>Forward</a></td>
          <td><img src='images/update.png'>&nbsp;<a href='updatestatus.php?id=$id'>Update</a></td>
          </tr>";
          plz help...
          i tried html code inside print statement... i get parse error....

          <a href="javascrip t:void(0);"
          NAME="My Window Name" title=" My title here "
          onClick=window. open("window-child.html","Ra tting","width=5 50,height=170,0 ,status=0,");>l ink</a>

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            Did you just copy/paste that HTML, including the double quotes, into the PHP strings, which is delimited by double quotes?

            Do you not see the logical fallacy there?

            PHP can not tell the difference between a double-quote meant to close the string and a double-quote meant to be a part of the string. So if you want a double quote to be a part of a string, it needs to be escaped or the string need be delimited by single quotes.

            Try reading through the string section of the tizag.com PHP tutorial. They explain this there.

            Comment

            Working...