title: Loop in Script not working
body: <p>I'm trying to redirect a user after a onclick action but the userid in the following code always remains the same regarless the user chosen in the table.
  Maybe I'm missing something here...</p>
  
  <pre><code>&lt;td&gt;
    &lt;?php if ($memberinfo['UserIsChecked'] == 1){ ?&gt;
      &lt;button class="btn btn-xs btn-icon btn-default"&gt; &lt;i class="fa fa-times"&gt;&lt;/i&gt; &lt;/button&gt;
    &lt;?php } else { ?&gt;
      &lt;a href="#"&gt;&lt;p onclick="go()"&gt;Approve/Refuse &lt;?php echo($memberinfo['UserId']) ;?&gt;&lt;/p&gt;&lt;/a&gt;
      &lt;script&gt;
        var userid='&lt;?php echo $userid;?&gt;';
        function go(){
          swal({
            title: 'Are you sure?',
            text: "You won't be able to revert this!",
            type: 'warning',
            showCancelButton: true,
            confirmButtonText: 'Validate user',
            cancelButtonText: 'Refuse request',
            confirmButtonClass: 'btn btn-success',
            cancelButtonClass: 'btn btn-danger m-l-10',
            buttonsStyling: false
          }).then(function () {
            swal(
              'User validated!',
              'The user has been notified.',
              'success',
            ).then(function(){
              window.location = 'scripts/process-validate-user.php?userid='+ userid +' ' ;
            })
          }, function (dismiss) {
            // dismiss can be 'cancel', 'overlay',
            // 'close', and 'timer'
            if (dismiss === 'cancel') {
              swal(
                'User refused',
                'The user has been notified.',
                'error'
              )
            }
          })
        }
      &lt;/script&gt;
    &lt;?php } ?&gt;
  &lt;/td&gt;
  </code></pre>