خرید بک لینک

Vote count: 0

I'm trying to make a table change a td depending on what is in my text document. No if the doc is empty I want it to have a white background with black text, but if there is content in side the document the set it the background to grey with white text. It also echos what's in the document in the second td. No it works if there is something in the document but if I change the document to "" it works but if I use my text box to set this value by clearing it with back spaces it doesn't work. The td is still grey with white text even know there isn't anything being display in it. Anyone got any ideas here?

Text Box Setter

<?php
$tb = $_POST['spo']."";

    if (isset($_POST['submit'])){
        $myFile=fopen("DATA/Spo.txt","w") or exit("Can’t open file!");
        fwrite($myFile, $tb);
        fclose($myFile);
        header("Location: SeniorManagersSiteTour.php");

    }
?>
<body>
    <h1 align="center">Site / Project / Office</h1>
    <form action="SiteProjectOffice.php" method="post" enctype="multipart/form-data" name="FileForm" id="FileForm">
        <input name="spo" type="text" size="size" maxlength="22" <?php $myFile=fopen("DATA/Spo.txt","r") or exit("Can't open file!"); echo 'value="'.fgets($myFile).'"'; fclose($myFile); ?>>

        <div id="btnDiv">
            <input id="submit" name="submit" type="submit" value="Save">
        </div>
    </form>
</body>

$Spo

$myFile=fopen("DATA/Spo.txt","r") or exit("Can't open file!");
$Spo = fgets($myFile);
fclose($myFile);

Table

<table border="0" width="100%" >
                    <tr>
                    <td width="26%" height="20px" <?php if (strlen($Spo) == 0){echo'bgcolor="#FFFFFF" style="color:black;"';}else{echo'bgcolor="999999" style="color:white;"';}?>><strong>Site / Project / Office</strong></td>
                    <td width="26%" height="20px" onclick="'SiteProjectOffice.php'"<?php if (strlen($Spo) == 0){echo'bgcolor="#FFFFFF" style="color:black;"';}else{echo'bgcolor="999999" style="color:white;"';}?>><?php echo $Spo; ?></td>
                    <td width="21%" height="20px"><strong>Contract Number</strong></td>
                    <td width="27%" height="20px" onclick="'ContractNumber.php'"><?php $myFile=fopen("DATA/Cont.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?></td>
                    </tr>
                    <tr>
                    <td height="20px" ><strong>Site Manager</strong><td colspan="4" onclick="'SiteManager.php'"><?php $myFile=fopen("DATA/Site.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?></td>
                    </tr>
                    <tr>
                    <td height="20px"><strong>Job / Task Description</strong><td colspan="4" onclick="'JobTaskDescription.php'"><?php $myFile=fopen("DATA/Job.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?></td>
                    </tr>
                </table>

asked 32 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 21 فروردين 1395 ساعت: 18:01

صفحه بندی