Results 1 to 9 of 9

Thread: So, my programmer is asleep...

  1. #1
    Site Contributor
    Join Date
    Oct 2003
    Location
    Sweet Carolina
    Posts
    736

    So, my programmer is asleep...

    My programmer is asleep and I want to do some work on a site of mine.

    I don't know anything about programming. Absolutely nothing. I just want to setup something simple so I can write some info on each state:

    <?php include("folder/<? echo $safe_state ?>"); ?>

    I took that echo command from higher up in the page, where $safe_state calls the abbreviation of a state. I want to setup a flat include file (SC.inc, FL.inc) for each state and have the page call it's appropriate file.

    <? echo $safe_state ?> by itself shows the right abbreviation for the state, but when I put it in the above include -- nothing shows. Even though I've checked and re-checked the directory path several times, it just shows up blank (even though there is content in the state file I'm calling).

    Why won't that PHP include above work?

    -- Sorry for the ignorance. I don't build sites myself

  2. #2
    Registered
    Join Date
    Aug 2006
    Location
    Sacramento, CA
    Posts
    208
    PHP Code:
    <?php include("folder/$safe_state.inc"); ?>
    The since you are already in php code you don't want the <? ?> you had in there.
    ________
    Volkswagen taro
    Last edited by rpanella; 03-17-2011 at 10:36 AM.

  3. #3
    Site Contributor
    Join Date
    Oct 2003
    Location
    Sweet Carolina
    Posts
    736
    But I'm not already in PHP code. I'm out of code when I'm putting that.

    Any other ideas?

  4. #4
    Chronic Entrepreneur
    Join Date
    Nov 2003
    Location
    Tulsa, Oklahoma, USA
    Posts
    1,112
    Try this:

    PHP Code:
    <?php include("folder/" $safe_state); ?>
    or possibly

    PHP Code:
    <?php include("folder/" $safe_state ".inc"); ?>

  5. #5
    Site Contributor
    Join Date
    Oct 2003
    Location
    Sweet Carolina
    Posts
    736
    Westech wins. Thanks.

  6. #6
    Registered
    Join Date
    Aug 2006
    Location
    Sacramento, CA
    Posts
    208
    My code is the same as his, so I'm not sure how it didn't work?

    What I meant by that was that you were using the PHP tags (<? and ?>) within a set of PHP tags.
    ________
    Creampie Vagina
    Last edited by rpanella; 03-17-2011 at 10:36 AM.

  7. #7
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    The <? tells the server to start parsing PHP the ?> tells it to stop parsing PHP. So you'll never have a <? and another <? without a ?> in between. I'm suprised the script even functioned.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  8. #8
    Site Contributor
    Join Date
    Oct 2003
    Location
    Sweet Carolina
    Posts
    736
    Oh. I think I have everyone confused. It works. It works well.

    That's all.

  9. #9
    Registered
    Join Date
    May 2005
    Posts
    81
    btw, it's best if you name your includes .inc.php so they don't show the plaintext source if someone knows the URL.. Or just make sure your includes are not in public_html

Similar Threads

  1. Seeking PHP programmer for a project
    By Chris in forum The Marketplace
    Replies: 6
    Last Post: 09-21-2006, 11:25 PM
  2. Need a PHP programmer who knows TextPattern well and can edit/change TXP Plugins
    By deronsizemore in forum Website Programming & Databases
    Replies: 15
    Last Post: 09-07-2006, 08:52 AM
  3. Looking for a perl programmer..!
    By Johan H in forum Website Programming & Databases
    Replies: 1
    Last Post: 05-04-2006, 08:41 AM
  4. Programmer needed
    By Cutter in forum The Marketplace
    Replies: 0
    Last Post: 04-14-2006, 06:18 PM
  5. Looking for a programmer
    By Cutter in forum Website Programming & Databases
    Replies: 8
    Last Post: 07-16-2005, 10:23 AM

Bookmarks

Posting Permissions

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