I do not have a clue as to what the problem is with this code. I am running php 7.0. This was an old form I used long ago, decided to upgrade it for random use. It works on php 5.0 but not in 7. I have run it through many php checks and not a problem is found. Does anyone have the answer for me? I would greatly appreciate it. No Errors shown just the white age of death.

<?php

include_once('jcart.php');

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

// Connects to your Database 
mysqli_connect("localhost", "dnk", "here1") or die(mysqli_error()); 
mysqli_select_db("dnnnk") or die(mysqli_error()); 

if (isset($_GET["Type"])) {
$Type = $_GET["Type"];
if (isset($_GET["AppID"])) {
$AppID = $_GET["AppID"];
}
else {
$AppID = 0;
}
$sql = "select * from parts WHERE ID = '$AppID'";
$result = mysqli_query($sql) or die(mysqli_error()); 
$row = mysqli_fetch_array($result);

}

?>
<body link="#293A2B" vlink="#8AAC91" alink="#000080">

<td height="70" style="font-family: Verdana; font-size: 14pt; text-decoration: overline underline; color: #3F5841; font-style: italic; font-weight: bold" width="321">
<p align="center"><?php echo htmlspecialchars($row["Manufacturer"]); ?></td>
<td width="351" align="center" height="70"><div style="width: 351px; height: 70px; overflow: auto">
  <div id="jcart"><?php $jcart->display_cart();?></div>
 </div></td>

<?php
  echo "<form method='post' action='' class='jcart'>
<input type='hidden' name='my-item-id' value='".$row['MfgNum']."'>
<input type='hidden' name='my-item-name' value='".$row['Description']."'>
<input type='hidden' name='my-item-price' value='".$row['Price']."'>
<input type='hidden' name='my-item-url' value=''>
<input type='hidden' name='my-item-core' value='".$row['CoreReq']."'>
";

echo "<tr>";
echo "<td align='left' valign='top' width='240' height='200' style ='font:16px/21px Arial,tahoma,sans-serif;color:navy'>".$row['Img']."</td>"; 
echo "<td align='left' valign='top' width='600' height='200' style ='font:14px/21px Arial,tahoma,sans-serif;color:navy'><br><br><br><b><u>Part Description:</u></b>&nbsp;&nbsp;".$row['Description']."<br>
<b><u>Manufacturer:</u></b>&nbsp;&nbsp;".$row['Manufacturer']."&nbsp;&nbsp;&nbsp;<br><b><u>Part Number:</b></u>&nbsp;&nbsp;".$row['MfgNum']."&nbsp;&nbsp;&nbsp;<br><b><u>Category:</b></u>&nbsp;&nbsp;".$row['Category']."&nbsp;&nbsp;&nbsp;<br><b><u>Core Required?:</b></u>&nbsp;&nbsp;".$row['CoreReq']."&nbsp;&nbsp;&nbsp;<br><br><b><u>Price:</u>&nbsp;&nbsp;</b>$".$row['Price']."<b>&nbsp;</b>".$row['UOM']."<br><br><a href='checkout.php'><img border='0' src='images/checkout.gif' width='119' height='21' alt='Checkout'></a>
<br><br>
<div style ='font:14px/21px Arial,tahoma,sans-serif;color:navy' id='fullTotal'></div> </td>  ";
 {
echo '<td><input type="text" name="my-item-qty" value="1" size="3" valign="top" align="center" /></td>';
echo '<td><input type="image" name="my-add-button" src="images/add_button.gif" border="0" alt="Add To Cart" value="add to cart" class="button" style="float: left" /></td><br>';

}

echo "</tr>";
echo "</form>";

?>

Recommended Answers

All 3 Replies

When facing this sort of issue I find myself adding print or echo debug lines so I can see how far the code went before it hung up OR to watch variables along the way. Noted in priors like https://www.php.net/manual/en/debugger.php you find that at some point you have to go old school (add lines to debug it.)

I changed this thread from code snippet to discussion/question. For future postings, code snippet is reserved for when you are posting a fully working and documented code snippet.

I know how you feel - PHP 7 has been trying its best to drive me crazy too.
I know its stricter than PHP 5, so I try to do my utmost best to adhere to the rules, like proper HTML construction.
I see in your code a body tag, but no html tag at the top or at the bottom. I also cannot find the closing body tag.
Did you omit these on purpose? If yes, adding them in might help.
Apart from manual debugging as suggested earlier, you could also try writing out the HTML code first, and running that to see if you have any errors from that end.
Let's know how it goes for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.