Page 1 of 1

Called PHP source not executing (winXP)

PostPosted: 23. December 2004 20:16
by pgeary
Folks,

I am hoping for some help with my PHP installation under windows xp. It was installed using the xampp script and seemed to go very well until i tried running the following html and php.

When the php code (searchform.php) is called windows wants to download the file not execute it. Any help is appreciated, I'm new at this and it is slow going.

Thanks,
Peter

There are two code files:

File 1 - searchform.htm

<html>
<body>
<form action=searchform.php method=GET>
Search for:
<p>
First Name: <input type=text name=fname size=15 maxlength=15>
<p>
Last Name: <input type=text name=lname size=15 maxlength=15>
<p>
<input type=submit>
</form>
</body>
</html>

File 2 - searchform.php

# ---- Begin searchform.php
<?
mysql_connect (<MySQLserver>, <username>, <password>);
mysql_select_db (<dbname>);
if ($fname == "")
{$fname = '%';}
if ($lname == "")
{$lname = '%';}
$result = mysql_query ("SELECT * FROM <tablename>
WHERE fname LIKE '$fname%'
AND lname LIKE '$lname%'
");
if ($row = mysql_fetch_array($result)) {
do {
print $row["fname"];
print (" ");
print $row["lname"];
print("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";
}
?>

# ---- End searchform.php

PostPosted: 23. December 2004 20:26
by chuyskywalker
Hrm, got any extra htaccess files around that might be doing that?

Have you played with the httpd.conf file at all?

Also:
Code: Select all
if ($fname == "")
{$fname = '%';}
if ($lname == "")
{$lname = '%';}


Shouldn't work any more. Register Globals is turned off by default (and should be). Use :
Code: Select all
if ($_GET['fname'] == "")
{$_GET['fname'] = '%';}
if ($_GET['lname'] == "")
{$_GET['lname'] = '%';}

PostPosted: 23. December 2004 22:43
by pgeary
Thanks for the reply. On your lead that it might be the installation I uninstalled and re-installed. The good news is that the PHP files are no longer being "downloaded", the bad news is that I am now getting the message "Invalid Menu Handle". ANy pointers? A web search hasn't helped resolve this message.

I have also made the recomended changes to the php script. - Thanks for the tip.

Peter

PostPosted: 24. December 2004 00:05
by chuyskywalker
pgeary wrote:"Invalid Menu Handle"


Never seen that one before. It's not giving you a line number or antying that's wrong with the script?

pgeary wrote:I have also made the recomended changes to the php script. - Thanks for the tip.


Sure.

PostPosted: 24. December 2004 00:22
by pgeary
The problem seems to be with a windows file association. Can you provide any advice on which program php files should be associated with?

Thanks for your persistence!!!!

PostPosted: 24. December 2004 00:43
by Wiedmann
The problem seems to be with a windows file association.

No.

You can not execute a php-script with a doubleclick in explorer.
You must open a php-script through the server:
http://localhost/test.php

Not:
file://xampp/htdocs/test.php