Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: [php]map oraz dane z bazy
Forum PHP.pl > Forum > Przedszkole
blazejwiecha
Mam pewn± stronê.
Jest na niej plik graficzny a na niego na³o¿one s± <map>
chcia³bym by po klikniêciu na dany fragment z tej grafiki (mapa polski) wy¶wietli³ mi dane z bazy mysql. Jest to div1
Jak mo¿na by by³o przekazaæ dane z konkretnego <map> do div2 zaraz obok, w którym jest lista rozwijana /??
Kod wygl±da narazie tak:
  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. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <!-- TemplateBeginEditable name="doctitle" -->
  6. <title>Untitled Document</title>
  7. <!-- TemplateEndEditable -->
  8. <!-- TemplateBeginEditable name="head" -->
  9. <!-- TemplateEndEditable -->
  10. <style type="text/css"> 
  11. <!-- 
  12. body {
  13. font: 100% Verdana, Arial, Helvetica, sans-serif;
  14. background: #666666;
  15. margin: 0; /* it's good practice to zero the margin and padding of the body element to account fo
    r differing browser defaults */
  16. padding: 0;
  17. text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left
     aligned default in the #container selector */
  18. color: #000000;
  19. }
  20.  
  21. /* Tips for Elastic layouts 
  22. 1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also
     more accessible for those that need larger fonts size since the line length rema
    ins proportionate.
  23. 2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a
     font-size: 80% on the body element or the #container, remember that the entire layout will dow
    nsize proportionately. You may want to increase the widths of the various divs to
     compensate for this.
  24. 3. If font sizing is changed in differing amounts on each div instead of on the 
    overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may w
    ant to adjust these divs based on your final font sizing.
  25. */
  26. .twoColElsRt #container { 
  27. width: 50em; /* this width will create a container that will fit in an 800px browser window if
     text is left at browser default font sizes */
  28. background: #FFFFFF;
  29. margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
  30. border: 1px solid #000000;
  31. text-align: left; /* this overrides the text-align: center on the body element. */
  32.  
  33. /* Tips for sidebar1:
  34. 1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingl
    y.
  35. 2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width f
    or standards compliant browsers creating an unknown actual width. 
  36. 3. Space between the side of the div and the elements within it can be created b
    y placing a left and right margin on those elements as seen in the ".twoColElsRt #sidebar1 p" rule.
  37. */
  38. .twoColElsRt #sidebar1 {
  39. float: right; 
  40. width: 12em; /* since this element is floated, a width must be given */
  41. background: #EBEBEB; /* the background color will be displayed for the length of the content in the co
    lumn, but no further */
  42. padding: 15px 0; /* top and bottom padding create visual space within this div */
  43. }
  44. .twoColElsRt #sidebar1 h3, .twoColElsRt #sidebar1 p {
  45. margin-left: 10px; /* the left and right margin should be given to every element that will be placed
     in the side columns */
  46. margin-right: 10px;
  47. }
  48.  
  49. /* Tips for mainContent:
  50. 1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div
     will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs.
  51. 2. The space between the mainContent and sidebar1 is created with the left margi
    n on the mainContent div. No matter how much content the sidebar1 div contains, the column space will rema
    in. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
  52. 3. To avoid float drop, you may need to test to determine the approximate maximu
    m image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their b
    rowser font size set lower than normal, less space will be available in the #main
    Content div than you may see on testing.
  53. 4. In the Internet Explorer Conditional Comment below, the zoom property is used
     to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur.
  54. */
  55. .twoColElsRt #mainContent {
  56. margin: 0 13em 0 1.5em; /* the left margin can be given in ems or pixels. It creates the space down the l
    eft side of the page. */
  57. }
  58.  
  59. /* Miscellaneous classes for reuse */
  60. .fltrt { /* this class can be used to float an element right in your page. The floated ele
    ment must precede the element it should be next to on the page. */
  61. float: right;
  62. margin-left: 8px;
  63. }
  64. .fltlft { /* this class can be used to float an element left in your page */
  65. float: left;
  66. margin-right: 8px;
  67. }
  68. .clearfloat { /* this class should be placed on a div or break element and should be the final 
    element before the close of a container that should fully contain a float */
  69. clear:both;
  70. height:0;
  71. font-size: 1px;
  72. line-height: 0px;
  73. }
  74. --> 
  75. </style><!--[if IE]>
  76. <style type="text/css"> 
  77. /* place css fixes for all versions of IE in this conditional comment */
  78. .twoColElsRt #sidebar1 { padding-top: 30px; }
  79. .twoColElsRt #mainContent { zoom: 1; padding-top: 15px; }
  80. /* the above proprietary zoom property gives IE the hasLayout it needs to avoid s
    everal bugs */
  81. </style>
  82. <![endif]--></head>
  83.  
  84. <body class="twoColElsRt">
  85.  
  86. <div id="container">
  87. <div id="sidebar1">
  88. <h3> <select name="lista" id="lista">
  89. <?php
  90. $connection = @mysql_connect('localhost', 'root', 'krasnal') 
  91. or die('Brak po³±czenia z serwerem MySQL'); 
  92. $db = @mysql_select_db('zbrojarnie', $connection) 
  93. or die('Nie mogê po³±czyæ siê z baz± danych');
  94.  
  95.  
  96.  
  97.  
  98.  
  99. /*Za³adowanie listy*/
  100. /*
  101. $query = "SELECT kraj,wojewodztwo,miasto,kod FROM miasto";
  102. $result = mysql_query($query);
  103. while ($users = mysql_fetch_array($result))
  104. {
  105. print("<OPTION VALUE=\"$users[0]\">$users[1]\n");
  106. }
  107. */
  108.  
  109. #testowe zapytania z rejonów mapy
  110. $query = "SELECT kraj,wojewodztwo,miasto,kod FROM miasto WHERE kod='test'";
  111. $result = mysql_query($query);
  112. while ($users = mysql_fetch_array($result))
  113. {
  114. print("<OPTION VALUE=\"$users[0]\">$users[1]\n");
  115. }
  116.  
  117. ?></select>
  118. </h3>
  119. <!-- end #sidebar1 --></div>
  120. <div id="mainContent">
  121. <h1>
  122. <img src ="images/mapa_polski_200.gif"
  123. width="558" height="539"
  124. alt="Planets"
  125. usemap ="#planetmap" />
  126.  
  127. <map id ="planetmap"
  128. name="planetmap">
  129. <area shape ="rect" coords ="255,477,304,529"
  130. href ="sun.htm" target ="_blank"
  131. alt="Sun" />
  132. <area shape ="rect" coords ="305,474,354,526"
  133. href ="sun.htm" target ="_blank"
  134. alt="Sun" />
  135. <area shape ="rect" coords ="414,465,459,517"
  136.  
  137. alt="Sun" />
  138. <area shape ="rect" coords ="461,409,506,461"
  139. href ="sun.htm" target ="_blank"
  140. alt="Sun" />
  141. <area shape ="rect" coords ="407,413,452,465"
  142. href ="sun.htm" target ="_blank"
  143. alt="Sun" />
  144. <area shape ="rect" coords ="359,418,404,470"
  145. href ="sun.htm" target ="_blank"
  146. alt="Sun" />
  147. <area shape ="rect" coords ="305,422,354,474"
  148. href ="sun.htm" target ="_blank"
  149. alt="Sun" />
  150. <area shape ="rect" coords ="253,425,302,477"
  151. href ="sun.htm" target ="_blank"
  152. alt="Sun" />
  153.  
  154. </map>
  155.  
  156. </h1>
  157. <!-- end #mainContent --></div>
  158. <!-- This clearing element should immediately follow the #mainContent div in order t
    o force the #container div to contain all child floats --><br class="clearfloat" />
  159. <!-- end #container --></div>
  160. </body>
  161. </html>
luniak
Radzê poczytaæ o technologi AJAX , to powinno ci pomóc
blazejwiecha
a tak mo¿e pokierowaæ , dok³adnie czego w tej technologii szukaæ mam
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.