Jump to content

urlencode/urldecode


clairian

Recommended Posts

Hi, i'm pretty new to php and am having trouble trying to secure my data passed over URL's with the urlencode/urldecode functions.

 

I'm using the following to encode the UID:

<a href="EditTenantFormT.php?UID=', urlencode(<?php echo  $row['UID'] ?>), '">Edit My Details</a><br />

 

I then want to decode the UID in EditTenantFormT but don't know how I would go about doing this.

 

Any help would really be appreciated.

 

Thanks

Claire

Link to comment
https://forums.phpfreaks.com/topic/97446-urlencodeurldecode/
Share on other sites

Your syntax is just a little muddled...

 

<?php
$row['UID'] = '&a234#304'; //a value that needs encoding
?>

<a href="edittenantformt.php?uid=<?php echo urlencode($row['UID']); ?>">Edit My Details</a>

<?php
//and then on the edit tentant form...
$uid = urldecode($_GET['uid']);
?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/97446-urlencodeurldecode/#findComment-498609
Share on other sites

Hi, thanks for the input, however that is still not working.

 

I have changed the syntax of the hyperlink:

<a href="EditTenantFormT.php?UID=<?php echo urlencode($row['UID']); ?>">Edit My Details</a

 

And the descode on the edit tenant form is:

$UID = urldecode($_GET['UID']);

 

This does pass the UID value through, but the UID value is still seen on the URL that is passed between the two:

http://localhost/OceanBlue/EditTenantFormT.php?UID=20

 

Is there anything else that I am missing?

Link to comment
https://forums.phpfreaks.com/topic/97446-urlencodeurldecode/#findComment-499406
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.