/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Firefox just dumps php code onto page

Hi everyone,
I have a simple php/mysql program that creates a table for a inventory list, e.g. part num, description, price,etc. It works fine in IE but FF and Safari just dump code onto the page, exactly the same way, …but not all the code. I’ve stripped out everything nonessential but can’t see the problem; here is
the coding listing followed by the dump listing:

<?php
session_start();
$page_title=”Product Table”;
require_once(‘mysql_db_connection.php’);
echo ‘<link href=”main.css” rel=”stylesheet” type=”text/css” />’;
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<link href=”CascadeMenu.css” rel=”stylesheet” />
<title>Untitled Document</title>
</head>
<body>
<div id=”main_wraper”>
<?php
$display=4;
if(isset($_GET[‘page’]))//check if page reloads indicating more than one page required;if not only one page required
{
$cur_page=$_
GET[‘page’];
}
else
{
$cur_page=1;
}
if(isset($_GET[‘np’]))
{
$numpages=$_
GET[‘np’];
}
else {
//perform the query to see total number of records rquired
$query=”SELECT COUNT(*) FROM items”;
$result=mysql_query($query) or die(mysql_error());
$row=mysql_fetch_array($result);
$rec_total=$row[0];
if($rec_total>$display){
$numpages=ceil($rec_total/$display);
}
else
{
$numpages=1;
}
}//end if get[np] isset
//check if the page reloads with a set query limit; if not query limit is set to start at zero
if(isset($_GET[‘start’]))
{
$start=$_
GET[‘start’];
}
else
{
$start=0;
}
$query2=”SELECT *
FROM items LIMIT $start, $display”;
$result2=mysql_query($query2) or die(mysql_error());
if(!$result2)
echo ‘<h3>THERE IS A PROBLEM WITH TABLE REULTS</h3>’;
//start output the table of product items
echo ‘<div id=”table”>
<h3>PRODUCT LISTING TABLE FOR PAGE:&nbsp;&nbsp;’.$cur_page.'</h3>’;
echo ‘<table cellspacing=”0″ cellpadding=”5″ border=”2″ width=”600″ align=”left” bgcolor=”#FFCC99″>
<tr><th>ITEM</th><th>MODEL</th><th>DESCRIPTION</th><th>UNIT PRICE</th><th>ENTER QUANTITY</th><th>&nbsp;&nbsp;BUY&nbsp;&nbsp;</th></tr>’;

echo ‘<p>Product Pages:&nbsp;&nbsp;’;
for($i=1;$i<=$numpages;$i++)
{
$start=$display*($i-1);
echo ‘<a href=”products.php?start=’.$start.’&np=’.$numpages.’&page=’.$i.'”>’.$i.’&nbsp;&nbsp;</a>’;
}

while($row=mysql_fetch_array($result2))
{

$part_num=$row[‘cat_num’];
echo ‘<form action=”curr_cart.php” method=”post”>
<input type=”hidden” name=”part_num” value=” ‘.$part_num.’ “>
<input type=”hidden” name=”action” value=”1″ >’;
echo ‘<tr><td><img src=”prod_images/’.$row[‘sm_pic’].'”</td><td>’.$row[‘sh_des’].'</td><td>’.$row[‘lg_des’].'</td><td>’.$row[‘unit_price’].'</td><td><input name=”quan” size=”5″ value=”1″></td>
<td><input type=”submit” value=”BUY” ></form></td></tr>’;
}
mysql_close();
?>
</div>
</body>
</html>

And here is what is being dumped onto the page!! (I did not include all of the dump, just first section)

‘; ?>
$display){ $numpages=ceil($rec_total/$display); } else { $numpages=1; } }//end if get[np] isset //check if the page reloads with a set query limit; if not query limit is set to start at zero if(isset($_GET[‘start’])) { $start=$_GET[‘start’]; } else { $start=0; } $query2=”SELECT * FROM items LIMIT $start, $display”; $result2=mysql_query($query2) or die(mysql_error()); if(!$result2) echo ‘

Any suggestions would be very appreciated
captsig

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@svidgenOct 08.2009 — The browser generally doesn't have anything to do with whether the server parses your PHP. If I had to guess, I would say IE is just hiding the PHP as a courtesy for your server misconfiguration (or MS just didn't feel like writing an HTML engine that would parse "plaintext" alongside HTML).

What's the URL of this beaut.
Copy linkTweet thisAlerts:
@captsigauthorOct 08.2009 — I was testing on XAMPP so the URL is 'localhost'; however, I just tried the pages on my remote site and they displayed properly???!!!

Svidgen, thank you for your time; I guess this will have to do for a solution.

captsigerson
Copy linkTweet thisAlerts:
@svidgenOct 08.2009 — Strange. Maybe there's a XAMPP forum or wiki with information regarding this issue, which would [B]appear[/B] to be a bug in the default configuration. That, of course, is assuming it should be configured by default to respond properly on port 80 to any IP address associated with the host ...
×

Success!

Help @captsig spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...