RE: [PHP] Space in php generated link....

From: Date: Sun, 27 Apr 2003 22:42:42 +0000
Subject: RE: [PHP] Space in php generated link....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145446@lists.php.net to get a copy of this message
> >I am getting some values from the database and according to that building > a > >link to modify the table via another php script. > >This is the main line down: > ><a href=modify.php?n=".$row[3]."&u=".$row[17]."&p=".$row[18].">Modify</a> > > > >$row[3] is for the "name" the others are not really important > > > >my problem is when the name is "thegreatname" its ok, but when there the > >firstname,lastname are entered like "Great Name" it gives me trouble.... > > > >when i go to click on the created link on top only "Great" shows > >eg: > >http://blahsite.com/php/modify.php?n=Great > >the other variables of "u" and "p" (username/pass) are not showing.... > > you could take the variables ort the total url through the php function > urlencode(), or any other, see http://www.php.net/manual/en/ref.url.php > and > http://www.php.net/manual/en/function.urlencode.php . > urlencode() wil change the space to %20 so you mght as well run > str_replace > on the row elements. You don't want to run (raw)urlencode() on the entire URL, just the values that your putting into it. The encoding functions also change other characters besides spaces, so it's not the same as just running str_replace(). ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#145446) next »