Skip navigation.
Home

echo "using echo sucks!";

Wonky Code

Nicely formatted, easy to read, but oh so wrong. The switch is bad enough but using all those echo makes me so angry. I pity all pour souls that have to work with code like this.

<?php
if(@$_POST['vote'] == TRUE)
{
   switch (@
$_POST['bewertung'])
       {
           case
"1":
             
$punkt = 1;
             break;
           case
"2":
             
$punkt = 2;
             break;
           case
"3":
             
$punkt = 3;
             break;
           case
"4":
             
$punkt = 4;
             break;
           case
"5":
             
$punkt = 5;
             break;
            case
"6":
             
$punkt = 6;
             break;
            case
"7":
             
$punkt = 7;
             break;
           case
"8":
             
$punkt = 8;
             break;
             case
"9":
             
$punkt = 9;
             break;
             case
"10":
             
$punkt = 10;
             break;
         }
mysql_query("INSERT INTO bewertung(repID,punkte) VALUES ('$repID','$punkt')");
}

/* hier kommt nur die Ausgabe der Puntkte nich relevant*/

echo "<table border=0 width=80 cellspacinng=0 cellpadding=0>";
echo
"  <tr>";
echo
"   <td>";
echo
"     <form method=\"post\" type=\"text/css\" action=\"http://www.example.com/index.php?section=Replays\">";
echo
"        <select name=\"bewertung\" size=\"1\">";
             for (
$bew = 1 ; $bew &lt;= 10 ; $bew++)
                     {
                       echo
"<option>".$bew."</option>";
                     }
echo
"   </td>";
echo
"   <td>";
echo
"              <input type=\"submit\" value=\"Vote\" name=\"vote\">";
echo
"            </form>";
echo
"   </td>";
echo
"  </tr>";
echo
"</table>";
?>

Error! You have used up your lifetime quota of tabs.

Wonky Code

Do you have a co-worker that writes perfectly formatted and meticulous code that is easy to read? This submitter doesn't. This code was written by his supervisor. Comments in code are submitters.

Personal Note: I had to work on some nasty code that put me in a foul mood today. However this cheered me up. I just have to keep repeating, "it can always get worse. It can always get worse!".

No more spaces for you!