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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.