Called PHP source not executing (winXP)

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

Called PHP source not executing (winXP)

Postby pgeary » 23. December 2004 20:16

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
pgeary
 
Posts: 3
Joined: 23. December 2004 19:42

Postby chuyskywalker » 23. December 2004 20:26

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'] = '%';}
chuyskywalker
 
Posts: 11
Joined: 23. October 2004 05:17

Postby pgeary » 23. December 2004 22:43

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
pgeary
 
Posts: 3
Joined: 23. December 2004 19:42

Postby chuyskywalker » 24. December 2004 00:05

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.
chuyskywalker
 
Posts: 11
Joined: 23. October 2004 05:17

Postby pgeary » 24. December 2004 00:22

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!!!!
pgeary
 
Posts: 3
Joined: 23. December 2004 19:42

Postby Wiedmann » 24. December 2004 00:43

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
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests