-2

I'm making an application in which a popup needs to open on button click, which contains three parameters. Everything works if I only pass 1 parameter, but if I pass more parameters (they are long), then no popup opens. What might be the problem here?

<?php
         $number = mt_rand(1,50000); //generate anti-csrf token
         $entry = base64_encode($number);
         $escape = sha1($number);
         ?>
           <a href="#" onclick="javascript:popUp(<?php echo $reviews->companyid; ?>,<?php echo $entry; ?>,<?php echo $escape; ?>);">Concur</a> |

Popup opener

<script type="text/javascript">
  function popUp(id,entry,escape)
  {
    popupWindow = window.open('admin_browse_userprofile.php?id='+id+'&entry='+entry+'&escape='+escape,'User','resizable=yes,scrollbars=yes,width=650,height=550');
      popupWindow.focus();
  }
  </script>
user3605847
  • 65
  • 2
  • 10

1 Answers1

1

Only reason the first one works is because you have anumber and numbers do not need quotes.

It throws an error because you have strings that are not wrapped in quotes.

popUp(123,FOO,BAR);

should be

popUp(123,'FOO','BAR');

And if the text inside contains " and ' you need to handle those.

epascarello
  • 204,599
  • 20
  • 195
  • 236