Php scripts

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Php scripts

Postby ElfN » 06. May 2009 20:27

I've installed xampp to work on Wordpress themes. It works great for that. I have an issue, however, with a site written in html/mysql/php. I moved the entire site to a folder inside htdocs. The navigation is done using php if statements. They don't work and I'm baffled as to why. Any thoughts?

This works fine:
Code: Select all
            if ($inc == 1) {
               echo "<IMG SRC=\"images/Library_f2.gif\" WIDTH=\"175\" HEIGHT=\"25\" BORDER=0 ALT=\"Articles on longlining, driving and movement\"><BR>";
            } else {
               echo "<a href=\"Library.php\"><IMG SRC=\"images/Library.gif\" WIDTH=\"175\" HEIGHT=\"25\" BORDER=0></a><BR>";
            }

I'm seeing the menu images. I can navigate away from the homepage only by going to the Library, which is a separate page.

This doesn't work.
Code: Select all
         if (!$inc) {
            include "Home.html";
         } elseif ($inc == 2) {
            include "Axwood.html";
         } elseif ($inc == 3) {
            include "ForSale.html";
         } elseif ($inc == 4) {
            include "Info.html";
         } elseif ($inc == 5) {
            include "Links.php";
         } elseif ($inc == 8) {
            include "Winter2004.html";
         } elseif ($inc == 9) {
            include "XMas2004.html";
         }

Only the If (!isset) occurs which tells me variables aren't being passed. What have I got set wrong?

ElfN
ElfN
 
Posts: 19
Joined: 06. May 2009 20:14

Re: Php scripts

Postby Wiedmann » 06. May 2009 20:43

Only the If (!isset) occurs which tells me variables aren't being passed. What have I got set wrong?

Read the PHP manual, chapter "external variables".
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Php scripts

Postby ElfN » 06. May 2009 21:18

The online copy works perfectly. http://officeelfsites.com/axwoodfarm/

The local copy doesn't work so it's got to be something in my local settings. The stuff in the wordpress folder works, so could it be something as simple as file permissions? This is the first time I've had php/mysql/apache installed, so am feeling my way through this.

ElfN
ElfN
 
Posts: 19
Joined: 06. May 2009 20:14

Re: Php scripts

Postby Wiedmann » 06. May 2009 21:43

The online copy works perfectly.

Be happy that the configuration from this server is so worse...

The local copy doesn't work so it's got to be something in my local settings.

Because XAMPP is using the default (and secure) settings for PHP, which are default since 7 years.

The stuff in the wordpress folder works,

So they know how to write code for PHP4 or 5 ;-)

as simple as file permissions

No. The code is "wrong" (or written for PHP3). Changing the PHP settings is really not the suggested solution.

Wiedmann wrote:Read the PHP manual, chapter "external variables".

Have you done this?
(There you can also read, with setting is "on" on your online server.)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Php scripts

Postby ElfN » 06. May 2009 21:50

Got it! Changed global vars to on, killed everything and restarted and I'm good to go.
ElfN
 
Posts: 19
Joined: 06. May 2009 20:14


Return to XAMPP for Windows

Who is online

Users browsing this forum: JJ_Tagy and 57 guests