# Route parameters with #

**URL:** <https://discourse.slimframework.com/t/route-parameters-with/1967>\
**Category:** Questions\
**Created:** [November 4, 2017, 7:49pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967 "2017-11-04T19:49:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 4, 2017, 7:49pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/1 "2017-11-04T19:49:01Z")

</div>

# or hash character is not passing in route parameters.

$this-\>post(’/postText/{data}’, function ($request, $response, $args) {  
# code…  
if($request-\>isPost()) {  
echo $feed = $args[‘data’]; //My input is ’ Hello world #world’. Output is only ‘Hello world’  
}  
});

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 4, 2017, 7:50pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/2 "2017-11-04T19:50:20Z")

</div>

Even here i have posted hash character but it is not visible on page why??

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 4, 2017, 8:26pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/3 "2017-11-04T20:26:13Z")

</div>

Without more info, that is the behavior I would expect. Can you post an example of the URL you are requesting and the route definition?

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 5, 2017, 6:07am UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/4 "2017-11-05T06:07:52Z")

</div>

$this-\>post(’/postText/{data}’, function ($request, $response, $args) {  
# code…  
if($request-\>isPost()) {  
echo $feed = $args[‘data’]; //My input is ’ Hello world #world’. Output is only ‘Hello world’  
}  
});

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 5, 2017, 12:03pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/5 "2017-11-05T12:03:26Z")

</div>

What does this give you?

```php
$this->post(’/postText/{data}’, function ($request, $response, $args) {
    $fragment = $request->getFragment();
    echo $fragment;
});

```

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 5, 2017, 12:28pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/6 "2017-11-05T12:28:51Z")

</div>

still facing same problem

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 5, 2017, 12:53pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/7 "2017-11-05T12:53:08Z")

</div>

I’m not sure I understand what you are trying to do. Browser’s don’t send the fragment (the part after the #).

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 5, 2017, 4:06pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/8 "2017-11-05T16:06:36Z")

</div>

Is there any solution of this problem??

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 5, 2017, 4:25pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/9 "2017-11-05T16:25:12Z")

</div>

I got this solution from stackoverflow and its working [https://stackoverflow.com/questions/47123743/hash-is-not-passing-as-route-parameter-in-slim-framework-api](https://stackoverflow.com/questions/47123743/hash-is-not-passing-as-route-parameter-in-slim-framework-api)

The # is a special character in the url spec, you can’t use it as input unless encoded.

From php use: urlencode() and urldecode()

From js use something like: encodeURIComponent()

That way you’ll get %23 instead of #, which will get stripped.

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 5, 2017, 4:35pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/10 "2017-11-05T16:35:15Z")

</div>

That might work… you would likely need to use regex to match the route and need two parameters. But why not just use a different delimiter than `#`? That would be much easier.

---

<div class="post-metadata">

**Author:** ![mhraza95](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mhraza95](https://discourse.slimframework.com/u/mhraza95)\
**Post date:** [November 5, 2017, 7:39pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/11 "2017-11-05T19:39:28Z")

</div>

I am not using # as delimiter, I m passing # as input.

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [November 6, 2017, 12:18pm UTC](https://discourse.slimframework.com/t/route-parameters-with/1967/12 "2017-11-06T12:18:13Z")

</div>

The main problem is that the browser won’t even send a request with a fragment part. The fragment part is resolved right there in the browser. So it’s reachable through JavaScript.
