0

I am using following javascript code to pass an id to url in php. I am using codeigniter as framework. But after I submit url I should get decrypted id to do further work in. I know there is no way to decrypt md5(). so if you have any idea to solve this problem please help me.

My javascript code is

function comdelete(id) {
    var result = confirm("Do you want to delete  ?");
    var myvar = "<?php echo md5(id); ?>";
    if (result) {
        window.location.href = "http://localhost/oxford/site/dcat?id=" + myvar;
    }
}
raj454raj
  • 299
  • 3
  • 12
lahiruk93
  • 69
  • 1
  • 1
  • 8

1 Answers1

1

You can not combine PHP with JavaScript, if you want encrypt a variable in JavaScript the method must be Javascript's MD5. If you want to do it in PHP, Ajax methods should be used, then you can assign the result to the variable myvar

Community
  • 1
  • 1