HTML PHP Formular

  • HTML PHP Formular

    Hi,

    Ich war mir nicht sicher wo hin das gehört also hab ichs mal hier gepostet.

    Ich will wein formulear in php erstellen und da ich neu in php bin wollt ich mal fragen wo ichs lerne kann oder mir jemand hier schnell hilft mein momentaner

    Nun aber um formular ich wollt ein formular das man ausfühlen muss und wenn man am ende den send knopf (oder wie der heist) drückt das es auf meine mysql datenbank gesaved und ichs dann sehe
    hier das formular im momentanen zustand (html)

    Quellcode

    1. <html>
    2. <head>
    3. <title>Unbenanntes Dokument</title>
    4. </head>
    5. <body>
    6. <center>
    7. <table>
    8. <tr><th>Nickname:&;lt;/th><th&
    9. gt;<input name="nickname" type="text" style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;" value="" /></th></tr>
    10. <tr><th>Produkt:&;lt;/th><th&
    11. gt;<input name="produkt" type="text" style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;" value="" /></th></tr>
    12. <tr><th>Preis:&;lt;/th><th&
    13. gt;<input name="pries" type="text" style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;" value="" /></th></tr>
    14. <tr><th>Welt:&;lt;/th><th&
    15. gt;<select input name="Welt">
    16. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Ankrador</option>
    17. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Bandrakon</option>
    18. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Dunladan</option>
    19. <tr><th>Kategorie:&;lt;/th><th&
    20. gt;<select input name="Kat">
    21. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Äxte</option>
    22. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Armbrüste</option>
    23. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Bauteile</option>
    24. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Bögen</option>
    25. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Dolche</option>
    26. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Keulen</option>
    27. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Rohstoffe</option>
    28. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Leichte Rüstung <i>Leder</i></option>
    29. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Leichte Rüstung <i>Wolle</i></option>
    30. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Schwere Rüstung</option>
    31. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Leichte Schilde</option>
    32. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Schwere Schilde</option>
    33. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Schwerter</option>
    34. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Stabwaffen</option>
    35. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Erdstab</option>
    36. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Feuerstab</option>
    37. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Luftstab</option>
    38. <option style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;">Wasserstab</option>
    39. </table>
    40. <input style="Border : #ffcc00 1px solid; Background-color: #000000; color: #000000&;quot; type="checkbox" name="Ver" />
    41. Verhandelbar<Br/>
    42. <input style="Border : #ffcc00 1px solid; Background-color: #000000; color: #000000&;quot; type="checkbox" name="Ver" />Aufbestellung<br/>
    43. <br/>
    44. <input name="best" type="submit" style="Background-color: #000000; Border: #ffcc00 thinsolid; color : #ffcc00; font-size : 14pt ; font-family : Vivante-DTC;" value="Eintragen"/>
    45. </from>
    46. </form>
    47. </center>
    48. </body>
    49. </html>
    Alles anzeigen
  • hi..

    hier ein paar tips:
    nutze css!!! schau dir den aktualisierten code an...

    vergessen hast du das <form> tag

    Quellcode

    1. <form method="post" action="2.php">


    2.php könnte dann so aussehen

    Quellcode

    1. <?php
    2. //connect zur datenbank
    3. $nickname = mysql_escape_string($_POST['nickname']);
    4. $produkt = mysql_escape_string($_POST['produkt']);
    5. mysql_query("insert into tabelle values($nickname, $produkt); ");
    6. ?>


    Hier ein bisschen Literatur:
    http://www.easy-coding.de/php-literatur-t61.html

    Und hier der neue html code

    Quellcode

    1. <html>
    2. <head>
    3. <style type="text/css">
    4. input, option {
    5. Background-color: #000000;
    6. Border: #ffcc00 thinsolid;
    7. color : #ffcc00;
    8. font-size : 14pt ;
    9. font-family : Vivante-DTC;
    10. }
    11. </style>
    12. <title>Unbenanntes Dokument</title>
    13. </head>
    14. <body>
    15. <center>
    16. <table>
    17. <form method="post" action="2.php">
    18. <tr><th>Nickname:</th><th>
    19. <input name="nickname" type="text" value="" /></th></tr>
    20. <tr><th>Produkt:</th><th>
    21. <input name="produkt" type="text" value="" /></th></tr>
    22. <tr><th>Preis:</th><th>
    23. <input name="pries" type="text" value="" /></th></tr>
    24. <tr><th>Welt:&;lt;/th><th&
    25. gt;<select input name="Welt">
    26. <option>Ankrador</option>
    27. <option>Bandrakon</option>
    28. <option>Dunladan</option>
    29. <tr><th>Kategorie:&;lt;/th><th&
    30. gt;<select input name="Kat">
    31. <option>Äxte</option>
    32. <option>Armbrüste</option>
    33. <option>Bauteile</option>
    34. <option>Bögen</option>
    35. <option>Dolche</option>
    36. <option>Keulen</option>
    37. <option>Rohstoffe</option>
    38. <option>Leichte Rüstung <i>Leder</i></option>
    39. <option>Leichte Rüstung <i>Wolle</i></option>
    40. <option>Schwere Rüstung</option>
    41. <option>Leichte Schilde</option>
    42. <option>Schwere Schilde</option>
    43. <option>Schwerter</option>
    44. <option>Stabwaffen</option>
    45. <option>Erdstab</option>
    46. <option>Feuerstab</option>
    47. <option>Luftstab</option>
    48. <option>Wasserstab</option>
    49. </table>
    50. <input type="checkbox" name="Verhandelbar" />
    51. Verhandelbar<Br/>
    52. <input type="checkbox" name="Aufbestellung" />Aufbestellung<br/>
    53. <br/>
    54. <input name="best" type="submit" value="Eintragen"/>
    55. </from>
    56. </form>
    57. </center>
    58. </body>
    59. </html>
    Alles anzeigen