As I change + by %2B

Asked

Viewed 49 times

2

I have a forum in my game where accounts with normal names (Ex: Biel) enter the profile normally, the profile link is for example ...../profile?pr=Biel.

But there are accounts that contain a + in front of the name (+Biel) and in the forum do not read the +, do not open the profile.

I would like to know how I do pro forum read the + and open the profile. The profile code is this:

<a href="profile?pr=<?=$oturum_kadi;?>" class="element-menu-principal">
  • takes a look at the documentation you have about this function of urlencode... https://www.php.net/manual/en/function.urlencode.php. I didn’t really understand what characters a user can have in their nickname when registering on the site. Maybe you putting an Alert when you have the symbols that are giving problem, indicating to the user to choose another name without the symbols would be less laborious!

1 answer

4

You can do this with urlencode()

<a href="profile?pr=<?=urlencode($oturum_kadi);?>" class="element-menu-principal">

Upshot:

<?php

echo urlencode('+Biel'); // %2BBiel
  • are hundreds of accounts using the +, not only to Biel ksaksk

  • is just an example, the result will depend on the value of your variable

  • If I wanted to change the + by %2B then I would have to do:

  • <?php echo urlencode ( '+'): %2B ???

  • not exactly, because not all user has the + at the beginning as you commented.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.