jimjx Posted November 25, 2007 Share Posted November 25, 2007 Hi everyone, I am trying to integrate a little bit of JS code into my PHP script. Basically, this is for a calendar script and if someone clicks on a date, I want a new window to open with the info in it. Right now I have this, and it does open a new window, but I need to be able to control the size and placement. $ap1 = '<a href="'.$calendar_open_url."?Y=$cal_year&m=$cal_month&d=$day_num&$ox_tail".'" target="'.$calendar_open_target.'">'; $ap2 = '</a>'; I tried to use this but no go, and I (admittedly) don't know enough PHP to get this straightened out. $ap1 = '<a href=\"\"onClick="window.open(\"'.$calendar_open_url.'?Y=$cal_year&m=$cal_month&d=$day_num&$ox_tail,'mywindow','width=400,height=200')'.'\" >'; $ap2 = '</a>'; Any suggestions on how I can accomplish this? Thanks in advance, Jim Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/ Share on other sites More sharing options...
BenInBlack Posted November 25, 2007 Share Posted November 25, 2007 you were off on your quote balance and you concatenations try this <?php $ap2 = "Open Window"; $ap1 = "<a href=\"javascript:void();\" onclick=\"window.open('".$calendar_open_url."?Y=".$cal_year."&m=".$cal_month."&d=".$day_num."&".$ox_tail."','mywindow','width=400,height=200')\">".$ap2."</a>"; echo $ap1; ?> Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/#findComment-398663 Share on other sites More sharing options...
jimjx Posted November 25, 2007 Author Share Posted November 25, 2007 Wow! Thank you for the very fast reply! I think that is very close to what I need with one exception, it is putting 2 </a> in, here is the output... <a href="javascript:void();" onclick="window.open('newCal.php?Y=2007&m=11&d=28&cal_id=0&language=english&gmt_ofs=0&view=d30','mywindow','width=400,height=200')"></a>28</td> Here is the complete section of the code, I cannot see why the </a> is coming before the number..... Jim Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/#findComment-398673 Share on other sites More sharing options...
trq Posted November 25, 2007 Share Posted November 25, 2007 This board probably added that somehow because your not using [ code ] [/ code ] tags to post your code. Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/#findComment-398675 Share on other sites More sharing options...
jimjx Posted November 25, 2007 Author Share Posted November 25, 2007 Oh crud, I didn't notice until now that my < / a > got converted to [ / u r l ].... So, change that in my last post please. :-\ Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/#findComment-398680 Share on other sites More sharing options...
jimjx Posted November 25, 2007 Author Share Posted November 25, 2007 Never mind, I found the problem.... $ap1 = "<a href=\"javascript:void();\" onclick=\"window.open('".$calendar_open_url."?Y=".$cal_year."&m=".$cal_month."&d=".$day_num."&".$ox_tail."','mywindow','width=400,height=200')\">"[color=red].[/color] $ap2 . '</a>'; Should have been: $ap1 = "<a href=\"javascript:void();\" onclick=\"window.open('".$calendar_open_url."?Y=".$cal_year."&m=".$cal_month."&d=".$day_num."&".$ox_tail."','mywindow','width=400,height=200')\">"[color=red];[/color] $ap2 . '</a>'; Thanks for all of the help, it works perfectly now. Jim Link to comment https://forums.phpfreaks.com/topic/78779-solved-javascript-and-php/#findComment-398685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.