Hi,
I am kind of new to php and am trying to use the urlencode and urldecode functions. I think I got the urlencode function to work but I am having trouble getting the urldecode function to work. I am basically trying to put the sections from the url into variables. This is what I have so far.
php:
page1.php
//connect to database, sql query etc
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$phone=$row[0];
$email=$row[1];
$first_name=$row[2];
$last_name =$row[3];
$link = "$first_name+$last_name+$phone+$email";
echo '<a href="page2.php?foo=', rawurlencod($link), '">Edit Record</a>';
{
?>
This returns the url
'
I am assuming that you use the urldecode to break this back down but am confused when I read the php manual about urldecode. I have also searched online for examples without any luck. I have also done some research on parse_url but dont think that will work in this case.
Like I said what I am trying to do is to break down the url values and put them into variables on page2.php. The reason I am doing this this way is because I want the option of modifying a record in a database and the link using the urlencode will pass the the returned values. I cant use a form because there is normally more than one record returned with my query.
If anyone could at least point me in the right direction I would appreciate it.
Thanks in advance
I am kind of new to php and am trying to use the urlencode and urldecode functions. I think I got the urlencode function to work but I am having trouble getting the urldecode function to work. I am basically trying to put the sections from the url into variables. This is what I have so far.
php:
page1.php
//connect to database, sql query etc
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$phone=$row[0];
$email=$row[1];
$first_name=$row[2];
$last_name =$row[3];
$link = "$first_name+$last_name+$phone+$email";
echo '<a href="page2.php?foo=', rawurlencod($link), '">Edit Record</a>';
{
?>
This returns the url
'
I am assuming that you use the urldecode to break this back down but am confused when I read the php manual about urldecode. I have also searched online for examples without any luck. I have also done some research on parse_url but dont think that will work in this case.
Like I said what I am trying to do is to break down the url values and put them into variables on page2.php. The reason I am doing this this way is because I want the option of modifying a record in a database and the link using the urlencode will pass the the returned values. I cant use a form because there is normally more than one record returned with my query.
If anyone could at least point me in the right direction I would appreciate it.
Thanks in advance