(I have input boxes asking data) How can I have it that if status = BOOKED that the font for status ONLY is in red? How can I put an if statement for that in here somehow <?php $saving = $_REQUEST['saving']; if ($saving == 1) { $data = '<table width=300 bgcolor=silver><tr><td>' . $_POST['datefrom1'] .'</td><td>'. $_POST['dateto1'] .'</td><td>'. $_POST['status1'] .'</td><td>'. $_POST['price1'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom2'] .'</td><td>'. $_POST['dateto2'] .'</td><td>'. $_POST['status2'] .'</td><td>'. $_POST['price2'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom3'] .'</td><td>'. $_POST['dateto3'] .'</td><td>'. $_POST['status3'] .'</td><td>'. $_POST['price3'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom4'] .'</td><td>'. $_POST['dateto4'] .'</td><td>'. $_POST['status4'] .'</td><td>'. $_POST['price4'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom5'] .'</td><td>'. $_POST['dateto5'] .'</td><td>'. $_POST['status5'] .'</td><td>'. $_POST['price5'] . '</td></tr></table>'; $file = "test.txt"; $fp = fopen($file, "w") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); echo "Saved to $file successfully!"; } ?> PHP: ? Thank you
hi there, <?php function color ($status) { if ($status == 'BOOKED') { echo '<font color="#FF0000">' .$status. '</font>'; } else { echo $status; } } $saving = $_REQUEST['saving']; if ($saving == 1) { $data = '<table width=300 bgcolor=silver><tr><td>' . $_POST['datefrom1'] .'</td><td>'. $_POST['dateto1'] .'</td><td>'. color($_POST['status1']) .'</td><td>'. $_POST['price1'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom2'] .'</td><td>'. $_POST['dateto2'] .'</td><td>'. $_POST['status2'] .'</td><td>'. $_POST['price2'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom3'] .'</td><td>'. $_POST['dateto3'] .'</td><td>'. $_POST['status3'] .'</td><td>'. $_POST['price3'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom4'] .'</td><td>'. $_POST['dateto4'] .'</td><td>'. $_POST['status4'] .'</td><td>'. $_POST['price4'] . '</td></tr>' . '<tr><td>' . $_POST['datefrom5'] .'</td><td>'. $_POST['dateto5'] .'</td><td>'. $_POST['status5'] .'</td><td>'. $_POST['price5'] . '</td></tr></table>'; $file = "test.txt"; $fp = fopen($file, "w") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); echo "Saved to $file successfully!"; } ?> PHP: I hope this helps..