Using A Variable as a value in php Header() function using UrlEncode()

I was using an EDIT page where the URL were like http://www.mahmudfaisal.com/edit_page?id=39

after the Submission of form, the page should be reloaded to the same page. so, I took the ID in a session variable:

I loved to use URLENCODE() function here.


$url_id = $_GET['id'];
$_SESSION['url_id'] = $url_id ;

// using necessary codes in here for edit data here ;

header('location: index.php?id=' . urlencode($_SESSION['url_id'])); 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s