e1seix Posted August 23, 2010 Share Posted August 23, 2010 Have a ton of pop-up javascript links in my page. To tidy up the code, I have decided to declare all links at top of the page to keep them together and simply use the variable within the "a" brackets. Let me show you: <? $brand_edit = 'javascript:void(0)"onclick="window.open('/admin/form.php?db=outlet&tbl=brands&auto_increment=<? echo $auto_increment; ?>&action=edtamp;step=1','none','width=750,height=250,menubar=no,status=no,resizable=no,location=no,toolbar=no,scrollbars=yes,left=50,top=50,titlebar=no')'; ?> <span class="float" style="width: 100px;"><a href="<? echo $brand_edit; ?>"><? echo $auto_increment; ?></a></span> However, something things to go wrong as I'm getting an "Parse error: syntax error, unexpected '=' in ... on line 12" Where am I going wrong with my syntax? Quote Link to comment Share on other sites More sharing options...
schilly Posted August 23, 2010 Share Posted August 23, 2010 your quotes are a mess. <? $brand_edit = "javascript:void(0)\" onclick=\"window.open('/admin/form.php?db=outlet&tbl=brands&auto_increment=$auto_increment;&action=edtamp;step=1','none','width=750,height=250,menubar=no,status=no,resizable=no,location=no,toolbar=no,scrollbars=yes,left=50,top=50,titlebar=no')\""; ?> Try that. If you're going to use short tags you might as well just do this: <span class="float" style="width: 100px;"><a href="<?=$brand_edit?>> Note that I left off the closing href quote because you are adding the onclick event in brand_edit you need to close it in the brand_edit string. I think that should work. Quote Link to comment Share on other sites More sharing options...
e1seix Posted August 23, 2010 Author Share Posted August 23, 2010 Would you suggest a smarter way of doing this? Quote Link to comment Share on other sites More sharing options...
schilly Posted August 23, 2010 Share Posted August 23, 2010 well if this isn't in a loop i would just do: <span class="float" style="width: 100px;"><a href="javascript:void(0);" onclick="window.open('/admin/form.php?db=outlet&tbl=brands&auto_increment=<?=$auto_increment?>;&action=edtamp;step=1','none','width=750,height=250,menubar=no,status=no,resizable=no,location=no,toolbar=no,scrollbars=yes,left=50,top=50,titlebar=no')"></a></span> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.