Page 1 of 1

passing string with spaces via url

Posted: Tue Mar 06, 2007 5:13 pm
by sarris
Hi there.
I have this string that i obtain from a database, $address.
I want to pass that via url,

Code: Select all

$html_block .= "<a href=printableTemplate.php?address=$ad&size=$size>Create Printable Template</a>";
$html_block is a string that keeps html code, to be echoed in the <body> section of the html...

The url created created for that link, if address is for example "SomestreetName 45" is

http://www.mysite.com/printableTemplate ... streetName

The number is not passed and not is the size parameter...
Anyone knows how to solve this?
thanks

Posted: Tue Mar 06, 2007 5:15 pm
by feyd
  1. Your anchor tag's href attribute lacks quotes.
  2. the data should be passed through rawurlencode() at minimum.

Posted: Tue Mar 06, 2007 5:56 pm
by sarris
very well...thank you!!!