Reputation: 1462
I am trying to pass id and username to next page via url and its working if the username has no spaces like "username", however when there is a space like "user name", only the name until the space will be passed to next page.
Here is my code:
<td>
<?php echo '<a href=selectedCustomer.php?user_name='.$user["username"]. "&user_id=" . $user["id"] . '>' . $user["username"] . '</a>'; ?>
</td>
Upvotes: 0
Views: 223
Reputation: 3341
You need to urlencode()
the parameter first:
<?php
echo '<a href=selectedCustomer.php?user_name='.urlencode($user["username"]). "&user_id=" . $user["id"] . '>' . $user["username"] . '</a>';
?>
Upvotes: 1