Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    119
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Very quick PHP help

    Hi All,

    I have a very short bit of PHP code where a page is called if parameters are met. However, the unique 'code' for the page is very similar to another page, and this is causing problems. See below:

    Code:
    <?php if ($code == 'council') 
    	      include ("php-bin/list_council_pages_dt.php"); ?>
    The two pages have 'code' fields of 'council' and 'councillors', and when it is on 'councillors' it is including the above file, and I don't want this to happen. Is there a way of restricting the 'IF' call to the exact word and not a part of it?

    Thanks,
    Neil

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,316
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Odd because it shouldn't be doing that.

    Try using a switch instead.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •