www.webdeveloper.com
Results 1 to 4 of 4

Thread: Echo long line of code cant put quotes properly

  1. #1
    Join Date
    Jul 2012
    Posts
    41

    Echo long line of code cant put quotes properly

    Code:
    echo "<th id='th$i' ><a href='' value='aa' onclick='window.open('windowing.php?q=' + document.getElementById('$myImage').value);'><input type='image' id='$myImage' value='10.255.255.255' src='img/ok.png' width='25' height='25'></a></th >";
    Already tired of trying different combinations of ' and " can anyone show the right way to do it. Or explain the logic behind this.
    Last edited by Stobor; 09-26-2013 at 04:12 AM.

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    542
    Try breaking it down:

    Code:
    echo "<th id='th$i'>";
    echo "<a href='' value='aa' onclick='";
    $url = "window.open(\"windowing.php?q=\" + document.getElementById(\"$myImage\").value);'>";
    echo $url;
    echo "<input type='image' id='$myImage' value='10.255.255.255' src='img/ok.png' width='25' height='25'></a>";
    echo "</th >";

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Another approach:
    PHP Code:
    <?php
    // some php code here
    ?>
    <th id='th' >
        <a href='' value='aa' onclick='window.open("windowing.php?q=" + document.getElementById("<?php echo $myImage;?>").value);'>
            <input type='image' id='<?php echo $myImage;?>' value='10.255.255.255' src='img/ok.png' width='25' height='25'>
        </a>
    </th >
    <?php
    // more php code
    ?>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Jul 2012
    Posts
    41
    Code:
    '<th id="th$i" ><form id="imageform"><input onclick="window.open(\'windowing.php?q=\' + this.value);" type="image" src="" id="'.$id.'" value="'.$row["IP"].'"  height="19" width="19" ></form></th >'
    Fixed

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles