Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.