What's Here?
Members: 136,916
Replies: 480,766
Topics: 74,945
Snippets: 2,567
Tutorials: 675
Total Online: 1,736
Members: 103
Guests: 1,633
Loading. Please Wait...
replacing the %20 with space
replacing the %20 with space
samn84
8 Mar, 2008 - 11:14 PM
New D.I.C Head
Joined: 21 Feb, 2008
Posts: 41
in my program i pass the values via url in the following manner: http://......../update.php?name=susan brown&company=tt inc and when i need to assign this info to variables in php page,i do this: $name=$_REQUEST['name']; $company=$_REQUEST['company']; echo "name: ".$name; echo "company: ".$company; in this case the output is as follows: name: susan company: tt and does not print the full names!!!!! SO the next thing i did to the above code is: $name=str_replace('%20',' ',$_REQUEST['name']; $company=str_replace('%20',' ',$_REQUEST['company']); echo "name: ".$name; echo "company: ".$company; but now the output shown is like this: name: susan%20brown company: tt%20inc i also tied this but it doesnt work: $name=str_replace(' ',' ',$_REQUEST['name']; any help/suggestion/idea wud be appreciated.
PsychoCoder
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:20 PM
using DIC.Core;
Joined: 26 Jul, 2007
Posts: 8,998
Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net
My Contributions
Use the
urldecode function available to you in PHP
php
$name = urldecode($_REQUEST['name']); $company = urldecode($_REQUEST['company']); echo "name: ".$name; echo "company: ".$company;
no2pencil
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:20 PM
My fridge be runnin OH NOEZ!
Joined: 10 May, 2007
Posts: 6,495
Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off
My Contributions
Try referencing the $_POST value with double quotes, like this:
CODE
$name=$_REQUEST["name"];
QUOTE(PsychoCoder @ 9 Mar, 2008 - 12:20 AM)
Use the
urldecode function available to you in PHP
*Hats of to PsychoCoder for the better solution*
PsychoCoder
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:29 PM
using DIC.Core;
Joined: 26 Jul, 2007
Posts: 8,998
Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net
My Contributions
Thank ya sir
samn84
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:32 PM
New D.I.C Head
Joined: 21 Feb, 2008
Posts: 41
does the urldecode function actually put the respective space back in the word like name :susan brown
PsychoCoder
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:49 PM
using DIC.Core;
Joined: 26 Jul, 2007
Posts: 8,998
Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net
My Contributions
Why yes sir it does
samn84
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:56 PM
New D.I.C Head
Joined: 21 Feb, 2008
Posts: 41
fanx m8!!!
PsychoCoder
RE: Replacing The %20 With Space 8 Mar, 2008 - 11:58 PM
using DIC.Core;
Joined: 26 Jul, 2007
Posts: 8,998
Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net
My Contributions
Anytime, glad I could help
musya
RE: Replacing The %20 With Space 9 Mar, 2008 - 12:34 AM
D.I.C Regular
Joined: 25 Apr, 2007
Posts: 291
Thanked: 1 times
Dream Kudos: 50
My Contributions
QUOTE(PsychoCoder @ 9 Mar, 2008 - 12:58 AM)
Anytime, glad I could help
Okay call me a noobie (which I am) but does this hide the url that shows up in the browser when the user opens the page? if not is there a way to do that? for example to hide the big long php queris such as are in this edit page now at the top of the page.
QUOTE
is there a way to hide that too just
QUOTE
???? Any hope here?
samn84
RE: Replacing The %20 With Space 9 Mar, 2008 - 01:09 AM
New D.I.C Head
Joined: 21 Feb, 2008
Posts: 41
yes i wna ask the same question too as to how to hide the querystring bit in the url....................
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month