BadGoat Posted April 23, 2007 Share Posted April 23, 2007 Hello! I have been trying to get a link to work which is in PHP but has a Java element to it.. And so far, I have not been successful. <td>echo"<a href=\"http://www.domain.com/edits/edit_status.php?diw_id=\".$row[diw_id].\"\" onClick=\"openPic('edits/edit_status.php?size=small','pop','600','200'); return false\">[edit]</a></td> When I mouse over the link, the edit_status.php?diw_id= is blank, not getting the ID#. Clicking the Edit pops up the new window as hoped for, just missing my data. Since I am relatively new, I would bet I am doing something very wrong. Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/ Share on other sites More sharing options...
mpharo Posted April 23, 2007 Share Posted April 23, 2007 Is that the whole chunk of code, cause you do not have a closing "; in your echo .... also how are you going in and out of html to php, cause you have <td> which is html and then you go right into echo for php without a <? and a closing ?> after the php... Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236329 Share on other sites More sharing options...
BadGoat Posted April 23, 2007 Author Share Posted April 23, 2007 My fault, I selectively tried to only include the link in question. Typically I use single quotes, but I run into problems (such as this one) when links have combinations of single and double quotes within them. A larger chunk of code: $get_firm_info = mssql_query("SELECT * FROM i_status WHERE status_id = '".$row['diw_status_id']."'"); $row=mssql_fetch_array($get_firm_info); $status_name = $row['status_name']; echo' <tr> <td class="selcol1">Status:</td> <td class="selcol2"> ' .$status_name. ' '; echo"<a href=\"http://www.domain.com/edit_status.php?diw_id=\".$row[diw_id].\"\" onClick=\"openPic('edits/edit_deposition_status.php?size=small','pop','600','200'); return false\">[edit]</a></td> </tr>"; Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236338 Share on other sites More sharing options...
mpharo Posted April 23, 2007 Share Posted April 23, 2007 My fault, I selectively tried to only include the link in question. Typically I use single quotes, but I run into problems (such as this one) when links have combinations of single and double quotes within them. A larger chunk of code: $get_firm_info = mssql_query("SELECT * FROM i_status WHERE status_id = '".$row['diw_status_id']."'"); $row=mssql_fetch_array($get_firm_info); $status_name = $row['status_name']; echo' <tr> <td class="selcol1">Status:</td> <td class="selcol2"> ' .$status_name. ' '; echo"<a href=\"http://www.domain.com/edit_status.php?diw_id=\".$row[diw_id].\"\" onClick=\"openPic('edits/edit_deposition_status.php?size=small','pop','600','200'); return false\">[edit]</a></td> </tr>"; In your echo you are escaping the " before you print the variable (diw_id=\".$row[diw_id].\"\") try this diw_id=\"".$row[diw_id]."\" Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236345 Share on other sites More sharing options...
BadGoat Posted April 23, 2007 Author Share Posted April 23, 2007 Thank you mpharo, that allowed me to see the ID in the string! A followup question: What is the best way to refresh the parent HTML frame that the link is launched from, upon clicking the SUBMIT button? Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236385 Share on other sites More sharing options...
mpharo Posted April 23, 2007 Share Posted April 23, 2007 javascript has: parent.document. functionality just use that and it will change the page from the parent page...something like this... parent.document.getElementById('image').src='picture2.gif'; Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236386 Share on other sites More sharing options...
BadGoat Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks, that gives me an idea of where to search/how to construct what I need. Many thanks! Link to comment https://forums.phpfreaks.com/topic/48339-solved-getting-a-link-to-work-with-php-and-javascript/#findComment-236387 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.