Jump to content

SYNTAX error in defining variable


e1seix

Recommended Posts

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.