Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get rid of the spaces?

Status
Not open for further replies.

stacybk

Programmer
Joined
Oct 22, 2003
Messages
15
Location
US
I have the following piece of code:

'<a href=&quot;'.$phpbb_root_path.
&quot;viewforum.php?f=$line['forum_id']&amp;o=$fid&quot; . '&quot;>' . $line_topic_title . &quot;</a>&quot;
The end of the URL it produces looks like the following:

viewforum.php?f=756&o%20=%2017

How do I get rid of those spaces after the 'o' and '='?
 
There's no way to tell this without having the actual full echo/print statement in context.

But, anyway, just to point one thing out:
PHP is not good about having array offsets enclosed within double quotes.
Code:
# PHP usually messes up:
echo(&quot;myscript.php?l=$whatever['keyname']&quot;);

# better:
echo(&quot;myscript.php?l=&quot;.$whatever['keyname']);

The parser has some issues with the nested double/single quote structure. The second way is also easier to interpret for the human reader.
 
I did have it the way you suggested and keep changing it in an effort to get rid of those spaces. I will try again. What other information would you need to see to help me?
 
I have no idea how the space between the o and the = sign is produced. The value that's appended could contain a leading space if it's a string.

You can post the code including the print statement. Please enclose it in [ignore]
Code:
[ignore] tags.
 
Thanks your ideas have helped!
 
you van also use streplace on the variabele before you send it to the url
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top