I have a table on a page that displays info from a database and everything is working fine but I want it so if the user entered data from another page to a certain field then the row on my data display table will turn red. Right now I have a If statement in every row of my table. Is it possible to have two if statements in a row? Here is my page code with the table.

<?
include "include/session.php";

include "include/z_db.php";
?>
<?

require "bottom.php";
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

</head>

<!-- <body bgcolor="#339999"> -->
<body bgcolor="white">

<img src="logo.jpg" width="197" height="193" align="right"><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br />
<FORM>
<INPUT TYPE="BUTTON" VALUE="New Tour" ONCLICK="window.location.href='http://www.integranite.net/EAToursDemo/Input.php'">
</FORM>
<?php
$result = mysql_query("SELECT * FROM Project");
?>
<div style="overflow:auto; height:30px; width:1650px">
<?php
echo "<table border='1'>
<tr>
<th width='200'>School</th>
<th width='200'>Teacher</th>
<th>First Contact start date</th>
<th>Development Start</th>
<th>Development End</th>
<th>Pricing Start</th>
<th>Pricing End</th>
<th>Marketing Start date</th>
<th>Price Based On</th>
<th>Trip Assigned To</th>
<th>Trip Made</th>
<th width='104'>Notes</th>
</tr>";
echo "</table>";
echo "</div>";
?>
<div style="overflow:auto; height:400px; width:1650px">
<?php
while($row = mysql_fetch_array($result))
{ 
$checkbox = '';
if ($row['TripMade'] == 1) $checkbox = ' checked'; 
?>
<!--<div style="overflow:auto; height:40px; width:155px">--!>
<table cellpadding="0" cellspacing="0" style="width:50px;">
<?php
echo "<table border='1'>";
echo "<tr>"; 
echo "<td width='200'>" .$row['School'] . "</td>";
echo "<td width='200'>" .$row['Teacher'] . "</td>";
if(!strcmp($row['dtFirstContactSt'], '0000-00-00')) {
echo "<td width='156'>" . "No Date </td>";
} else {
echo "<td width='156'>" .$row['dtFirstContactSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentSt'], '0000-00-00')) {
echo "<td width='126'>" . "No Date </td>";
} else {
echo "<td width='126'>" .$row['dtDevelopmentSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentEnd'], '0000-00-00')) {
echo "<td width='119'>" . "No Date </td>";
} else {
echo "<td width='119'>" .$row['dtDevelopmentEnd']. "</td>";
};
if(!strcmp($row['dtPricingSt'], '0000-00-00')) {
echo "<td width='83'>" . "No Date </td>";
} else {
echo "<td width='83'>" .$row['dtPricingSt']. "</td>";
}
if(!strcmp($row['dtPricingEnd'], '0000-00-00')) {
echo "<td width='76'>" . "No Date </td>";
} else {
echo "<td width='76'>" .$row['dtPricingEnd']. "</td>";
}
if(!strcmp($row['dtMarketingSt'], '0000-00-00')) {
echo "<td width='142'>" . "No Date </td>";
} else {
echo "<td width='142'>" .$row['dtMarketingSt']. "</td>";
}
echo "<td width='104'>" .$row['PriceBasedOn']. "</td>";
echo "<td width='115'>" .$row['TripAssignedTo']. "</td>"; 
 ?>
<td width="72"><input type="checkbox" name="TripMade" value="Yes" <?= $checkbox ?>></td>
<td><textarea name="Notes" rows="1" cols="10"><?php echo $row["Notes"]?></textarea> </td>
<?php
echo "<td>" . "<a href=Edit_Form.php?UniqueIdentifier=$row[UniqueIdentifier]> Edit </a></td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
mysql_close($con);
?>

<br />

<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<center>
 

</body>

</html>

I know this inst probably the easiest thing to understand but any help is appreciated.

Recommended Answers

All 4 Replies

If I understand your question correctly, you might need something like:

if (condition A  AND condition B) {
  some action
}
elseif (condition A) {
  some other action
}

I tryed this but got nothing

if(!strcmp($row['dtFirstContactSt'] AND $row['dtMarketingSt'] , '0000-00-00' AND '0000-00-00')) {
echo "<td width='156'>" . "&nbsp </td>";
} else {
echo "<td bgcolor=FF0000 width='156'>" .$row['dtFirstContactSt']. "</td>";
}
if(!strcmp($row['dtFirstContactSt'], '0000-00-00') AND !strcmp($row['dtMarketingSt'], '0000-00-00')) {
echo "<td width='156'>" . "&nbsp </td>";
} else {
echo "<td bgcolor=FF0000 width='156'>" .$row['dtFirstContactSt']. "</td>";
}

Ahh thank you so much :)

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.