|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
<script language="JavaScript"> function Return(){parent.history.back()}</script> <?php echo"Tabellen-Generator"; ?> <table cellpadding="0" cellspacing="0" border="0" width="97%" align="center"> <tr> <td colspan="2">Diese Seite soll Ihnen das Erstellen von Tabellen ein weing erleichtern. Geben Sie einfach Zeilenanzahl sowie Spaltenanzahl ein und drücken Sie auf ausführen. Es erscheint die Beispieltabelle sowie der Quelltext dieser Tabelle, den Sie einfach nur kopieren brauchen.<br><br></b></b></td> </tr><tr> <td width="200"><form method="post"> <table width="200" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="2">Bitte geben Sie die gewünschten Werte ein:</td> </tr><tr> <td>Anzahl Zeilen:</td> <td><input type="text" name="zeilen" size="2"></td> </tr><tr> <td>Anzahl Spalten:</td> <td><input type="text" name="spalten" size="2"></td> </tr><tr> <td>Zellenabstand:</td> <td><input type="text" name="cs" size="2">px</td> </tr><tr> <td>Zelleninnenabstand:</td> <td><input type="text" name="cp" size="2">px</td> </tr><tr> <td>Rahmendicke:</td> <td><select name="dicke"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option></select</td> </tr><tr> <td colspan="2"><input type="submit" value="ausführen"></td> </tr> </table> </form> </td> <td> <?php if($zeilen=="" || $spalten==""){ echo"<div style=\"position:relative;width:100%;border:1px solid #FF0000;padding:4px\">Bitte geben Sie die Zeilen / Spalten Anzahl ein !!</div>"; echo"</td></tr></table>"; } else{ if($dicke==0) { echo"<table cellpadding=\"$cp\" cellspacing=\"$cs\" border=\"0\" width=\"100%\" align=\"center\">\n"; for($iz=1;$iz<=$zeilen;$iz++) { echo"<tr>\n"; for($is=1;$is<=$spalten;$is++) { echo"\t\t<td style=\"border:1px dashed #CCCCCC;\">Ihr Inhalt</td>\n"; } echo"\t</tr>"; } echo"\n</table>\n"; } else { echo"<table cellpadding=\"$cp\" cellspacing=\"$cs\" border=\"$dicke\" width=\"100%\" align=\"center\">\n"; for($iz=1;$iz<=$zeilen;$iz++) { echo"<tr>\n"; for($is=1;$is<=$spalten;$is++) { echo"\t\t<td align=\"center\">Ihr Inhalt</td>\n"; } echo"\t</tr>"; } echo"\n</table>\n"; } echo"</td>\n"; echo"</tr><tr>"; echo"<td> </td>"; echo"<td>"; echo"<div style=\"position:relative;\">"; echo"<textarea cols=\"80\" rows=\"10\">"; echo"<table cellpadding=\"$cp\" cellspacing=\"$cs\" border=\"$dicke\" width=\"100%\" align=\"center\">\n"; for($iz=1;$iz<=$zeilen;$iz++){ echo"<tr>\n"; for($is=1;$is<=$spalten;$is++){ echo"\t<td>Ihr Inhalt</td>\n"; } echo"</tr>"; } echo"\n</table>\n"; echo"</textarea>\n"; echo"</div>"; echo"</td></tr></table><br><br>"; } ?> <table border="0" cellpadding="0" cellspacing="0" width="97%" align="center"> <tr> <td width="97%"> <p align="right"><a class="navtext1" href="javascript:Return()">zurück</a></td> </tr> </table><br><br> |
|
|
PHP Quellcode |
1 2 |
$zeilen = $_POST['zeilen']; $spalten = $_POST['spalten']; |
Kann ich nur zu stimmen. Funktionen erhöhen wirklich die Übersicht und spart dir, in vielen Fällen, SchreibarbeitDas gleiche gilt für die anderen Variablen. Ist das irgendeine Aufgabe? Du solltest unbedingt Funktionen lernen, um deinen Code etwas übersichtlicher zu gestalten.
Hier mal ein Einstiegstutorial: http://tut.php-quake.net/de/function.html
UPDATE: Da waren wir aber alle drei ziemlich schnell![]()