Jump to content

missing ) after argument list


seran128

Recommended Posts

I am getting this error in my javascript my code where the error is being generated and in red

the output of this in the bottom of my browser looks like

javascript: buynow(500 Gold,125.00);

but when I press on the image i get the error

missing ) after argument list I believe its needing to have the text wraped in '500 Gold' but I can't figure how do do that in the code below.

[code]$specials .= "<table width='200' border='0' >
    <tr>
      <td align='center'>" . stripslashes($row['short_description']) . "</td>
[color=red]<td align='center'><a href='javascript: buynow(". stripslashes($row[title]) .",".$row[real_cost].");'><img src='/images/bnscroll.png' width='40' height='26' align='absmiddle' border='0' /></td>[/color]    </tr>
    <tr>
      <td align='center' colspan='2' ><span class='copy'>...........................................</span></td>
    </tr>
  </table>";[/code]
Link to comment
https://forums.phpfreaks.com/topic/29765-missing-after-argument-list/
Share on other sites

When specifying a string and enclosing it in double quotes, you can include double quotes within the string itself by escaping them by preceeding them with a backward slash. The same goes for including single quotes within a string enclosed with single quotes:[code]<?php
$specials .= "<table width=\"200\" border=\"0\" >
    <tr>
      <td align=\"center\">" . stripslashes($row['short_description']) . "</td>
[color=red]<td align=\"center\"><a href=\"javascript: buynow('". stripslashes($row[title]) ."','".$row[real_cost]."');\"><img src=\"/images/bnscroll.png\" width=\"40\" height=\"26\" align=\"absmiddle\" border=\"0\" /></td>[/color]    </tr>
    <tr>
      <td align=\"center\" colspan=\"2\" ><span class=\"copy\">...........................................</span></td>
    </tr>
  </table>";
?>[/code]
[quote author=artacus link=topic=117679.msg480287#msg480287 date=1165466339]
You need to have non-numeric parameters quoted.

javascript: buynow("500 Gold","125.00");
[/quote]
He already stated he thought that was the problem. His problem was he didn't know how to include it in the string.

Archived

This topic is now archived and is closed to further replies.

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