Html anfrage an PHP ohne seiten Akktualiesierung

  • HTML

Es gibt 14 Antworten in diesem Thema. Der letzte Beitrag () ist von Sonderzeichen.

    Html anfrage an PHP ohne seiten Akktualiesierung

    Hallo zusammen, ich würde gerne mit meiner Seite ein Anfrage auf den Mysql server stellen,
    das Problem ist aber das ich meistens eine weiße Seite mit der Rückantwort bekomme ich würde es gerne auf der eigenen Seite(von wo aus der befehl los ging) starten.

    Und die Antwort in dem Gleichen Textfeld wiedergeben
    Vlt hilft ein bild zu verständniss


    Kann mir jm. helfen ?
    api.jquery.com/jquery.ajax/
    Ließ dich ein bisschen rein, geht recht schnell, auch als JavaScript-Anfänger.
    Dann solltest du das Problemlos schaffen ;)

    lg

    @wolfi_bayern
    Hättest du das Thema gelesen, möchte er ohne Seitenaktualisierung das Ergebnis bekommen.
    ...aber gut, dass wir darüber gesprochen haben!
    Also ich hab zugleich auch ein Bissel bei Youtube geschaut und das gefunden nachdem ich einigen Videos schauen, was auf gefallen ist
    code.jquery.com/jquery-1.9.1.js
    diese datei ist bei den Meinsten eingebunden, muss ich das auch machen ??
    Sorry aber ich hab echt kein Plan von Javascrip , die Uni wollte sowas :)

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „Dani=mc^2“ ()

    diese datei ist jquery - eine library (erweiterung) für javascript, somit soll javascript einfach konfortabler einsetzbar sein!
    Ja, falls du eine aktualisierung ohne browser seiten laden haben willst, dann benötigst du jquery auf jedenfall um genauer zu sein brauchst du ajax (ein bestandteil von jquery)

    1. pack mal den mittleren block von den 3 abbildugen in deinen startpost in eine datei
    2. binde jquery ein
    3. mache einen ajaxrequest auf diese datei und das ergebnis schreibst du dann in deine tabelle
    Also das ganze sieht jetzt so aus

    Spoiler anzeigen
    HTML
    Spoiler anzeigen

    HTML-Quellcode

    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml">
    3. <head>
    4. <link rel="stylesheet" href="Aussehen.css"/>
    5. <script type="text/jscript" src="jquery-1.9.1.js"></script>
    6. <script type="text/javascript">
    7. $(document).ready(function(){
    8. $("#Einfügen").submit(function(){
    9. if($("#TName").val() == "" || $("#TNachname").val() == ""|| $("#TAlter").val() == "" || $("#TAlter").val() == "")
    10. {
    11. $("#Message_in").html("Bitte füllen sie <strong>alles</strong> aus");
    12. }else{
    13. $("#Message_in").html("Erfolgreich");
    14. $.ajax({
    15. type: "POST",
    16. url: "Conn.php",
    17. data: $("#TName").val() + $("#TNachname").val() + $("#TAlter").val(),
    18. success: function(Smsg){
    19. $("#Message_in").html(msg);
    20. }
    21. });
    22. }
    23. return false;
    24. });
    25. });
    26. </script>
    27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    28. </head>
    29. <title>Untitled Document</title>
    30. <body>
    31. <div class="container">
    32. <div class="header"><a href="#"><img src="" alt="Insert Logo Here" name="Insert_logo" width="180" height="90" id="Insert_logo" style="background-color: #C6D580; display:block;" /></a>
    33. <!-- end .header --></div>
    34. <div class="sidebar1">
    35. <!-- end .sidebar1 --></div>
    36. <div class="content">
    37. <h1>Personenverwaltung </h1>
    38. <h2><strong>Person hinzufügen</strong></h2>
    39. <form id="Einfügen" name="form1" method="post" action="Conn.php">
    40. <div>
    41. <table width="367" border="0">
    42. <tr>
    43. <td width="102">Name</td>
    44. <td width="131">
    45. <input type="text" width="180" name="TName" id="TName" /></td>
    46. </tr>
    47. <tr>
    48. <td width="102">Nachname</td>
    49. <td width="131">
    50. <input type="text" width="180" name="TNachname" id="TNachname" /></td>
    51. </tr>
    52. <tr>
    53. <td width="102">Alter</td>
    54. <td width="131">
    55. <input type="number" width="180" name="TAlter" id="TAlter" /></td>
    56. </tr>
    57. <tr>
    58. <td width="102">Land</td>
    59. <td width="131">
    60. <select width="180" name="SLand" id="SLand">
    61. </select></td>
    62. </tr>
    63. </table>
    64. <div id=button><input type="submit" value="Eintragen"/></div>
    65. <div id="Message_in"></div>
    66. </div>
    67. </form>
    68. <hr />
    69. <h2> <!-- end .content -->Person anzeigen</h2>
    70. <form id="form2" name="form2" method="post" action="">
    71. <table width="367" border="0">
    72. <tr>
    73. <td width="129">Auslesebefehl:</td>
    74. <td width="172"><label for="textfield8"></label>
    75. <input width="180" type="text" name="MYSQLI" id="textfield8" /></td>
    76. </tr>
    77. </table>
    78. </form>
    79. <p>&nbsp;</p>
    80. </div>
    81. <div class="sidebar2">
    82. <h4>&nbsp;</h4>
    83. <!-- end .sidebar2 --></div>
    84. <div class="footer">
    85. <p>&nbsp;</p>
    86. <!-- end .footer --></div>
    87. <!-- end .container --></div>
    88. </body>
    89. </html>

    PHP
    Spoiler anzeigen

    PHP-Quellcode

    1. <?php
    2. $Ht = "Localhost"; //Host-typ
    3. $Bn = "multiphoto_Uni"; //Username
    4. $Bp = "SPRAKUNI"; //Password
    5. $DN = "multiphoto_Uni"; //Name der Datenbank, nicht der Tabelle
    6. $kp = $_POST['TName'];
    7. echo $kp;
    8. ?>

    Css
    Spoiler anzeigen

    Quellcode

    1. <!--
    2. body {
    3. font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    4. background-color: #42413C;
    5. margin: 0;
    6. padding: 0;
    7. color: #000;
    8. }
    9. /* ~~ Element/tag selectors ~~ */
    10. ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
    11. padding: 0;
    12. margin: 0;
    13. }
    14. h1, h2, h3, h4, h5, h6, p {
    15. margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
    16. padding-right: 15px;
    17. padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
    18. }
    19. a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
    20. border: none;
    21. }
    22. /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    23. a:link {
    24. color: #42413C;
    25. text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    26. }
    27. a:visited {
    28. color: #6E6C64;
    29. text-decoration: underline;
    30. }
    31. a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
    32. text-decoration: none;
    33. }
    34. /* ~~ This fixed width container surrounds all other divs ~~ */
    35. .container {
    36. width: 960px;
    37. background-color: #FFFFFF;
    38. margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    39. }
    40. /* ~~ The header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo. ~~ */
    41. .header {
    42. background-color: #ADB96E;
    43. }
    44. /* ~~ These are the columns for the layout. ~~
    45. 1) Padding is only placed on the top and/or bottom of the divs. The elements within these divs have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
    46. 2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a div set to float right). Many times, padding can be used instead. For divs where this rule must be broken, you should add a "display:inline" declaration to the div's rule to tame a bug where some versions of Internet Explorer double the margin.
    47. 3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar divs could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    48. 4) If you prefer your nav on the right instead of the left, simply float these columns the opposite direction (all right instead of all left) and they'll render in reverse order. There's no need to move the divs around in the HTML source.
    49. */
    50. .sidebar1 {
    51. float: left;
    52. width: 180px;
    53. background-color: #EADCAE;
    54. padding-bottom: 10px;
    55. }
    56. .content {
    57. padding: 10px 0;
    58. width: 600px;
    59. float: left;
    60. }
    61. .sidebar2 {
    62. float: left;
    63. width: 180px;
    64. background-color: #EADCAE;
    65. padding: 10px 0;
    66. }
    67. /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    68. .content ul, .content ol {
    69. padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    70. }
    71. /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    72. ul.nav {
    73. list-style: none; /* this removes the list marker */
    74. border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
    75. margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    76. }
    77. ul.nav li {
    78. border-bottom: 1px solid #666; /* this creates the button separation */
    79. }
    80. ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
    81. padding: 5px 5px 5px 15px;
    82. display: block; /* this gives the anchor block properties so it fills out the whole LI that contains it so that the entire area reacts to a mouse click. */
    83. width: 160px; /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
    84. text-decoration: none;
    85. background-color: #C6D580;
    86. }
    87. ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
    88. background-color: #ADB96E;
    89. color: #FFF;
    90. }
    91. /* ~~ The footer styles ~~ */
    92. .footer {
    93. padding: 10px 0;
    94. background-color: #CCC49F;
    95. position: relative;/* this gives IE6 hasLayout to properly clear */
    96. clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
    97. }
    98. /* ~~ Miscellaneous float/clear classes ~~ */
    99. .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    100. float: right;
    101. margin-left: 8px;
    102. }
    103. .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
    104. float: left;
    105. margin-right: 8px;
    106. }
    107. .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the .container) if the .footer is removed or taken out of the .container */
    108. clear:both;
    109. height:0;
    110. font-size: 1px;
    111. line-height: 0px;
    112. }
    113. #SQLI {
    114. width: auto;
    115. }
    116. -->

    Also das ganze sieht jetzt so aus

    Des heißt...? Thema erledigt? Oder klappt nicht?

    Wenn ich dir nen Tipp geben darf, schreib dir eine Funktion für den Ajax-Request. Also erstelle 'default.js' oder so ähnlich und mach dir dort ne Funktion die sich immer darum kümmert, sodass du an die Funktion nur die aufzurufende URL und (optional) die Request-Method (GET oder POST) und (ebenfalls optional) noch den eindeutigen Bezeichner des Elements in dem die Ausgabe platziert werden soll. Und dann bindest diese 'default.js' (oder wie immer die heißt bei dir) ganz normal im <head><script src='default.js'></script></head>



    Link :thumbup:
    Hello World
    So ok aber ich bekomm komm keine Antwort von der php

    Webseite

    Und dort ist schon das nächste Problem, Professor will das ich in die Dropdown liste die Länder aus der Datenbank nehme, ich hab es erstmal mit den namen versucht, aber kommt nichts zurück

    Als hilfe hatte ich das Video aber damit komm ich jetzt auch nicht weiter,und mein englisch(auch Deutsch) ist nicht wirklich gut :)

    Edit: Ok die anfrage klappt jetzt, aber wie bekomm nicht die Richtigen werte aus der PHP :?
    Webseite mit javascript und php code

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Dani=mc^2“ ()

    Hi,

    ich versteh z.B. nicht woher du die Variable "msg" (Zeile 19 im HTML-Code) nimmst.
    Änder mal in deinem PHP-Code die Zeile 9 und schreibe $kp = "test";

    Btw:



    Link :thumbup:
    Hello World
    Also die variable msg hab ich in der Function festgelegt vom Javascript
    So das Array was du das siehst ist die Ausgabe der PHP mittlerweile.
    So aber irgendwie ist es nicht das Richtige was er ausgeben soll

    Er müsste
    "Daniel
    Prinzessin
    Laura
    Easyy Mhm" ausgeben
    wen mein SQL-Befehl
    "Select Name From Test" ist
    Ok ich hab was gefunden dazu
    Seite
    JEY der erste teil Klappt, ich danke schon mal
    aber es geht noch weiter

    E dit

    Jetzt ist mein Problem das ich, wen ich jm. einlese das Alles bei Name Landet
    Edit

    Sehr gut erklärt
    für PHP,MySql,HTML und JQUERY.ajax
    formget.com/submit-form-using-ajax-php-and-jquery/

    Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von „Dani=mc^2“ ()

    Lösung von meiner Seite
    Dennoch habich eine Frage, wie kann ich dem Javasrcipt etwas übergeben (Parameter)
    Spoiler anzeigen

    HTML
    Spoiler anzeigen

    HTML-Quellcode

    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml">
    3. <head>
    4. <link rel="stylesheet" href="http://multiphoto.bplaced.net/Aussehen.css"/>
    5. <script type="text/jscript" src="http://multiphoto.bplaced.net/jquery-1.9.1.js"></script>
    6. <script type="text/javascript" >
    7. $(document).ready(function(){
    8. $("#Einfügen").submit(function(){
    9. var name = $("#TName").val();
    10. var Nachname = $("#TNachname").val();
    11. var Alter = $("#TAlter").val();
    12. var Land = $("#jumpMenu").val()
    13. var dataString = 'TName='+ name + '&TNachname='+ Nachname + '&TAlter='+ Alter + '&Land=' + Land;
    14. if($("#TName").val() == "")
    15. {
    16. $("#Message_in").html("Bitte füllen sie <strong>Name</strong> aus");
    17. }else{
    18. $.ajax({
    19. type: "POST",
    20. url: "http://multiphoto.bplaced.net/UserEinlesen.php",
    21. data: dataString,
    22. cache: false,
    23. success: function(msg){
    24. $("#Message_in").html(msg);
    25. }
    26. });
    27. }
    28. return false;
    29. });
    30. });</script>
    31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    32. <form id="Land" name="Land" method="POST" action="http://multiphoto.bplaced.net/Auslesen.php"></form>
    33. </head>
    34. <title>Untitled Document</title>
    35. <body>
    36. <div class="container">
    37. <div class="header"><a href="#"><img src="" alt="Insert Logo Here" name="Insert_logo" width="180" height="90" id="Insert_logo" style="background-color: #C6D580; display:block;" /></a>
    38. <!-- end .header --></div>
    39. <div class="sidebar1">
    40. <!-- end .sidebar1 --></div>
    41. <div class="content">
    42. <h1>Personenverwaltung </h1>
    43. <h2><strong>Person hinzufügen</strong></h2>
    44. <form id="Einfügen" name="form1" method="post" action="Conn.php">
    45. <div>
    46. <table width="367" border="0">
    47. <tr>
    48. <td width="102">Name</td>
    49. <td width="131">
    50. <input type="text" width="180" name="TName" id="TName" /></td>
    51. </tr>
    52. <tr>
    53. <td width="102">Nachname</td>
    54. <td width="131">
    55. <input type="text" width="180" name="TNachname" id="TNachname" /></td>
    56. </tr>
    57. <tr>
    58. <td width="102">Alter</td>
    59. <td width="131">
    60. <input type="number" width="180" name="TAlter" id="TAlter" /></td>
    61. </tr>
    62. <tr>
    63. <td width="102">Land</td>
    64. <td width="131">
    65. <select name="jumpMenu" id="jumpMenu" >
    66. <option>Deutschland</option>
    67. <option>Frankreich</option>
    68. <option>Italien</option>
    69. <option>Schweden</option>
    70. <option>Polen</option>
    71. <option>Österreich</option>
    72. <option>Schweiz</option>
    73. </select></td>
    74. </tr>
    75. </table>
    76. <div id=button><input type="submit" value="Eintragen"/></div>
    77. <div id="Message_in"></div>
    78. </div>
    79. </form>
    80. <hr />
    81. <h2> <!-- end .content -->Person anzeigen</h2>
    82. <form id="form2" name="form2" method="post" action="">
    83. <table width="367" border="0">
    84. <tr>
    85. <td width="129">Auslesebefehl:</td>
    86. <td width="172"><label for="textfield8"></label>
    87. <input width="180" type="text" name="MYSQLI" id="textfield8" /></td>
    88. </tr>
    89. </table>
    90. </form>
    91. <p>&nbsp;</p>
    92. </div>
    93. <div class="sidebar2">
    94. <h4><a href="Ausl.txt">Php Code</a></h4>
    95. <h4><a href="Bla.txt">.Js Code</a></h4>
    96. <!-- end .sidebar2 --></div>
    97. <div class="footer">
    98. <p>&nbsp;</p>
    99. <!-- end .footer --></div>
    100. <!-- end .container --></div>
    101. </body>
    102. </html>

    CSS
    Spoiler anzeigen

    CSS-Quellcode

    1. <!--
    2. body {
    3. font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    4. background-color: #42413C;
    5. margin: 0;
    6. padding: 0;
    7. color: #000;
    8. }
    9. /* ~~ Element/tag selectors ~~ */
    10. ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
    11. padding: 0;
    12. margin: 0;
    13. }
    14. h1, h2, h3, h4, h5, h6, p {
    15. margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
    16. padding-right: 15px;
    17. padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
    18. }
    19. a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
    20. border: none;
    21. }
    22. /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    23. a:link {
    24. color: #42413C;
    25. text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    26. }
    27. a:visited {
    28. color: #6E6C64;
    29. text-decoration: underline;
    30. }
    31. a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
    32. text-decoration: none;
    33. }
    34. /* ~~ This fixed width container surrounds all other divs ~~ */
    35. .container {
    36. width: 960px;
    37. background-color: #FFFFFF;
    38. margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    39. }
    40. /* ~~ The header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo. ~~ */
    41. .header {
    42. background-color: #ADB96E;
    43. }
    44. /* ~~ These are the columns for the layout. ~~
    45. 1) Padding is only placed on the top and/or bottom of the divs. The elements within these divs have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
    46. 2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a div set to float right). Many times, padding can be used instead. For divs where this rule must be broken, you should add a "display:inline" declaration to the div's rule to tame a bug where some versions of Internet Explorer double the margin.
    47. 3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar divs could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    48. 4) If you prefer your nav on the right instead of the left, simply float these columns the opposite direction (all right instead of all left) and they'll render in reverse order. There's no need to move the divs around in the HTML source.
    49. */
    50. .sidebar1 {
    51. float: left;
    52. width: 180px;
    53. background-color: #EADCAE;
    54. padding-bottom: 10px;
    55. }
    56. .content {
    57. padding: 10px 0;
    58. width: 600px;
    59. float: left;
    60. }
    61. .sidebar2 {
    62. float: left;
    63. width: 180px;
    64. background-color: #EADCAE;
    65. padding: 10px 0;
    66. }
    67. /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    68. .content ul, .content ol {
    69. padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    70. }
    71. /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    72. ul.nav {
    73. list-style: none; /* this removes the list marker */
    74. border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
    75. margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    76. }
    77. ul.nav li {
    78. border-bottom: 1px solid #666; /* this creates the button separation */
    79. }
    80. ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
    81. padding: 5px 5px 5px 15px;
    82. display: block; /* this gives the anchor block properties so it fills out the whole LI that contains it so that the entire area reacts to a mouse click. */
    83. width: 160px; /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
    84. text-decoration: none;
    85. background-color: #C6D580;
    86. }
    87. ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
    88. background-color: #ADB96E;
    89. color: #FFF;
    90. }
    91. /* ~~ The footer styles ~~ */
    92. .footer {
    93. padding: 10px 0;
    94. background-color: #CCC49F;
    95. position: relative;/* this gives IE6 hasLayout to properly clear */
    96. clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
    97. }
    98. /* ~~ Miscellaneous float/clear classes ~~ */
    99. .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    100. float: right;
    101. margin-left: 8px;
    102. }
    103. .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
    104. float: left;
    105. margin-right: 8px;
    106. }
    107. .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the .container) if the .footer is removed or taken out of the .container */
    108. clear:both;
    109. height:0;
    110. font-size: 1px;
    111. line-height: 0px;
    112. }
    113. #SQLI {
    114. width: auto;
    115. }
    116. -->

    Javascript einzeln
    Spoiler anzeigen

    Java-Quellcode

    1. $(document).ready(function(){
    2. $("#Einfügen").submit(function(){
    3. var name = $("#TName").val();
    4. var Nachname = $("#TNachname").val();
    5. var Alter = $("#TAlter").val();
    6. var Land = $("#jumpMenu").val()
    7. var dataString = 'TName='+ name + '&TNachname='+ Nachname + '&TAlter='+ Alter + '&Land=' + Land;
    8. if($("#TName").val() == "")
    9. {
    10. $("#Message_in").html("Bitte füllen sie <strong>Name</strong> aus");
    11. }else{
    12. $.ajax({
    13. type: "POST",
    14. url: "http://multiphoto.bplaced.net/UserEinlesen.php",
    15. data: dataString,
    16. cache: false,
    17. success: function(msg){
    18. $("#Message_in").html(msg);
    19. }
    20. });
    21. }
    22. return false;
    23. });
    24. });

    PHP
    Spoiler anzeigen

    PHP-Quellcode

    1. <?php
    2. //einstellungen
    3. include 'ConnectDaten.php'; //mysql verbindungsdaten
    4. $BeN = $_POST['Bname']; //benutzername
    5. $BeP = $_POST['Bpassword']; //benutzerpassword
    6. $BeA = $_POST['Balter']; //benutzeralter
    7. $BeE = $_POST['Bemail']; // benutzeremail
    8. $Dn= "multiphoto"; // Datenbank name, Nicht Tabellenname
    9. $sql_connet = mysql_connect($Ht,$Bn,$Bp) or die("Fx00"); // verbindung zur Datenbank
    10. mysql_select_db($Dn) or die("Datenbank existiert nicht"); // schauen Datenbank exitiert
    11. //eintragen
    12. $db_erg = mysqli_query(mysqli_connect($Ht,$Bn,$Bp,$Dn),"SELECT * FROM Benutzer");
    13. while ($zeile = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
    14. {
    15. if ($zeile['Nam'] == $BeN)
    16. {
    17. echo "User gibt es schon Bitte gehn sie zurück";
    18. exit;
    19. }
    20. }
    21. mysqli_free_result( $db_erg );
    22. $eintragen =
    23. or die("Fx02");
    24. $eintragen = mysql_query("INSERT INTO Benutzereigenschaften (Benutzername, Benutzeralter, Benutzeremail) VALUES ('$BeN', '$BeA','$BeE')")
    25. or die("Fx03");
    26. //ende Eintragen
    27. ?>


    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „Dani=mc^2“ ()

    also muss ich das dann so machen `?
    Javascript einzeln
    Spoiler anzeigen

    Java-Quellcode

    1. $(document).ready(function(){
    2. $("#Einfügen").submit(function(){
    3. var name = $("#TName").val();
    4. var Nachname = $("#TNachname").val();
    5. var Alter = $("#TAlter").val();
    6. var Land = $("#jumpMenu").val()
    7. var dataString = 'TName='+ name + '&TNachname='+ Nachname + '&TAlter='+ Alter + '&Land=' + Land;
    8. if($("#TName").val() == "")
    9. {
    10. $("#Message_in").html("Bitte füllen sie <strong>Name</strong> aus");
    11. }else{
    12. $.ajax({
    13. type: "POST",
    14. url: "http://multiphoto.bplaced.net/UserEinlesen.php",
    15. data: dataString,
    16. cache: false,
    17. success: function(msg){
    18. $("#Message_in").html(msg);
    19. }
    20. });
    21. }
    22. return false;
    23. });
    24. });
    Kleine Anmerkungen:
    JavaScript schreibt man generell am Ende vom Body.
    Also vor dem schließenden Body-Tag kommt der JavaScript-Stuff hin.
    Zudem ist die 1.9.1 nicht die aktuellste. Nutz lieder die aktuelle 2.1.1, die du hier findest: code.jquery.com/jquery-2.1.1.min.js
    Nun sollte dir aufgefallen sein, dass sich im Dateinamen ein "min" befindet. Dies bedeutet, dass diese Datei "minified" ist, also alles in einer Zeile steht.
    Ist um einiges performanter ;). Die Funktionen von jQuery oder so werden dadurch nicht beeinträchtigt.

    Ich kann dir übrigens UIKit ans Herz legen. Kannst du mit Bootstrap vergleichen. Beinhaltet was du brauchst, und die Dokumentation ist schön einfach. Außerdem steht dort in der Doku irgendwo, wie das mit dem dynamischen Seitenaufbau via Ajax funktioniert, mit einem Beispiel bei dem die Daten jedoch aus einer JSON Datei geladen ;)
    ...aber gut, dass wir darüber gesprochen haben!