Jump to content

Spaces in PHP include


howard-moore

Recommended Posts

I have a PHP page where I call a Perl script with the name of a particular field (Committees) being the search delimiter. The issue I have is where the Committee has spaces in its name:

 

<?php include ("$domain/php-bin/councillors.pl?order_by=Surname&order=abc&template=2&method=all&Committees=$Committees"); ?>

 

Therefore, if the end of the include is

[b]...&Committees=Example One"); ?>[/b]

it will fail to show up. I believe that it is caused by the fact that I cannot use spaces when including a PHP file, but I have also tried with replacing the spaces with %20, and this also does not work.

 

Any help would be gratefully received.

Thanks,

Neil

Link to comment
https://forums.phpfreaks.com/topic/183843-spaces-in-php-include/
Share on other sites

urlencode is a function and as such it shouldn't be kept inside a string which is what your doing, just look at the highlighting...

<?php
include("$domain/php-bin/councillors.pl?order_by=Surname&order=abc&template=2&method=all&Committees=',urlencode($Committees), '");
?>

 

..it should be..

 

include("$domain/php-bin/councillors.pl?order_by=Surname&order=abc&template=2&method=all&Committees=".urlencode($Committees));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.