ricardillo: hitergrundsfarbe

ich will das eine bedingung wird das hitergrundsfarbe eie zelle sich ändern.

<input type="text" size="17" style="<?
if($erg>'0'){"background-color:#FFCC66";}?>"
name="zelle16" value="<? @print $last_inserted[0][5];?>">

leider das geht nicht kann jemand mir sagen wo das fehler liegt.

  1. Ich will auch vieles, sag aber trotzdem "Hallo".

    probier´s mal mit

    <input type="text" size="17" style="<?php if($erg > 0) echo "background-color:#FFCC66"; ?> name="zelle16" value="<? @print $last_inserted[0][5];?>

    Gruß, Lirpa

    1. hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo hallo

      vielen dank,

      es hat super geklapp

  2. Hallo ricardillo,

    das ist jetzt dein viertes Posting zum Thema Hintergrund einer Zelle änderen, wenn das Datum einen bestimmten Wert überschreitet.

    Gruß Mia

  3. Hi,

    Du solltest lieber ein paar Zeichen (<?php statt <?) mehr schreiben, sonst kann es passieren, dass nach dem nächsten PHP-Update Deines Web-Hosters Deine Scripte nicht mehr laufen. Die Sache mit den Abkürzungen kann man nämlich auch in der PHP-Ini abschalten.

    <input type="text" size="17" style="<?php if($erg>'0') { print "background-color:#FFCC66"; } ?>" name="zelle16" value="<?php print $last_inserted[0][5]; ?>">

    oder:

    <?php
      if ($erg > '0') {
        $bgcolor = "background-color:#FFCC66";
      }
      else {
        $bgcolor = "";
      }
      $lastins = $last_inserted[0][5];
    ?>

    <input type="text" size="17" style="<?php print $bgcolor ?>" name="zelle16" value="<?php print $lastins; ?>">

    was bei längeren PHP-Abschnitten innerhalb des HTML für weniger Chaos sorgt...

    MfG
    Danny