Jump to content

[SOLVED] Help getting this hyperlink to function in PHP, has java


BadGoat

Recommended Posts

Hello!

 

I am trying to get a hyperlink with embedded php to work also with a java function. The goal is to get all the data associated with the 'diw_id' record. The link, in it's current, non-working state:

 

echo"<a href=\"/edits/edit_status.php?diw_id=".$row[diw_id]."\" onClick=\"openPic('/edits/edit_status.php?'.$row[diw_id].' size=small','pop','600','200'); return false\">[edit]</a></td>

 

openPic is a Java function:

 

function openPic (url,name,wide,high) {

var window_top = (screen.height-high)/2;

var window_left = (screen.width-wide)/2;

newWindow = window.open('' + url + '',''+ name +'','height=' + high +',width=' + wide + ',top=' + window_top + ',left=' + window_left + ', scrollbars'); } function closeWindow() {

  if (window.newWindow && window.newWindow.open && !window.newWindow.closed)

    window.newWindow.close();

 

I'm not that familiar with Java, would I be better served leaving the URL out of the function, or is that a requirement?

OK, going through my own code, I found I constructed the Java portion incorrectly.

 

Now,

        echo"<a href=\"/edits/edit_status.php?diw_id=".$row[diw_id]."\" onClick=\"openPic('/edits/edit_status.php?diw_id='".$row[diw_id]."' size=small','pop','600','200'); return false\">[edit]</a></td> "; echo'

 

The above gives me the correct data but the pop-up window functionality is not working.

 

But if I do

        echo"<a href=\"/edits/edit_status.php?diw_id=".$row[diw_id]."\" onClick=\"openPic('/edits/edit_status.php?diw_id=".$row[diw_id]." size=small','pop','600','200'); return false\">[edit]</a></td> "; echo'

 

instead, the pop-up functionality works, but the SQL data is not pulled.

 

I don't understand why your tacking size=small onto the end of the url. Also.. you don't need half of it.

 

<?php

echo "<a href=\"#\" onClick=\"openPic('/edits/edit_status.php?diw_id={$row['diw_id']}','pop','600','200'); return false\">[edit]</a></td>";

?>

 

As for your database part... can we see some relevant code.

 

PS; Its Javascript not Java, there is a huge difference between the two languages.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.