# On edit form accept id and character as primary key

**URL:** https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892
**Category:** Need Help
**Created:** [February 8, 2018, 2:36pm UTC](https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892 "2018-02-08T14:36:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pritesh.b](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@pritesh.b](https://discourse.cakephp.org/u/pritesh.b)
#### Post date: [February 8, 2018, 2:36pm UTC](https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892/1 "2018-02-08T14:36:27Z")

</div>

Eg. [http://example.org/articles/edit/5](http://example.org/articles/edit/5)

this url fetch the record which has primary key 5, but in following url

[http://example.org/articles/edit/5dsadasd](http://example.org/articles/edit/5dsadasd)

this is also get same record but i pass primary key **5dsadasd**.

Please tell me How to prevent them ??

---

<div class="post-metadata">

### Author: ![Salines](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/salines/32/3166_2.png) [@Salines](https://discourse.cakephp.org/u/Salines)
#### Post date: [February 9, 2018, 6:43pm UTC](https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892/2 "2018-02-09T18:43:22Z")

</div>

ib db,

id colum is INT?  
in cakephp did you create form, controller and model with cake bake tools?

---

<div class="post-metadata">

### Author: ![pritesh.b](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@pritesh.b](https://discourse.cakephp.org/u/pritesh.b)
#### Post date: [February 10, 2018, 4:56am UTC](https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892/3 "2018-02-10T04:56:39Z")

</div>

yes column is int type.

---

<div class="post-metadata">

### Author: ![skumar](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@skumar](https://discourse.cakephp.org/u/skumar)
#### Post date: [February 13, 2018, 12:32pm UTC](https://discourse.cakephp.org/t/on-edit-form-accept-id-and-character-as-primary-key/3892/4 "2018-02-13T12:32:09Z")

</div>

I think you need to modify the routing for that like below:  
$routes-\>connect(’/articles/edit/:id’, [‘controller’ =\> ‘Articles’,‘action’=\>‘edit’],[‘id’ =\> ‘[0-9]’, ‘pass’ =\> [‘id’]]);

Try this and let me know is it working or not.
