Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> pola wyboru (checkbox), MySQL-php
bart023
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 1.03.2005

Ostrzeżenie: (0%)
-----


Witam!!

Przedstawie najpierw problem:
-chciałbym stworzyć pola wyboru,
po pierwsze- wyciągam dane z tabeli jakiejś tam bazy i wyświetlam je. Teraz chciałbym aby każdy wyśiwtlony wiersz miał opcję wyboru aby po wciśnięciu przycisku np:Dalej została otwarta nowa strona na której będą już tylko te wiersze które wybrałem.
Czy tak powinna wyglądać ppierwsza strona??
I jak powinien wyglądać kod drugie??
  1. <?php
  2. $conn = pg_connect("host=...... port=...... user=...... password=...... dbname=......."); 
  3.  
  4. $wynik = pg_query("SELECT aaaa, bbbb, cccc, dddd FROM tabela ");
  5. $ilosc_wierszy=pg_num_rows($wynik);
  6.  
  7. $ile=pg_numfields($wynik);
  8. for($b=0;$b<$ile;$b++)
  9. {
  10.  $name[$b]=pg_fieldname($wynik,$b);
  11. }
  12.  print "<tr>";
  13. {
  14.  print "<td><b><small>aaaa</small></b></td>";
  15.  }
  16.  {
  17.  print "<td><b><small>bbbb</small></b></td>";
  18.  }
  19.  {
  20.  print "<td><b><small>cccc</small></b></td>";
  21.  }
  22.  {
  23.  print "<td><b><small>dddd</small></b></td>";
  24.  }
  25.  print "</tr>"; 
  26.  
  27.  
  28. while ($wiersz = pg_fetch_array($wynik,null,PGSQL_NUM))
  29.  {
  30. print "<tr>";
  31. foreach ($wiersz as $w)
  32. {
  33. print "<td><small>$w</small></td>";
  34. }
  35. {
  36. questionmark.gifquestionmark.gifquestionmark.gifquestionmark.gifquestionmark.gifquestionmark.gif?echo "<form method='POST' action='wyslij_wytypuj.php'>";questionmark.gifquestionmark.gifquestionmark.gifquestionmark.gifquestionmark.gif?
  37. print "<td><INPUT type='checkbox' name='nazwa' value='$w' ></td>";
  38. }
  39. print "</tr>";
  40.  }
  41.  
  42.  
  43. print "<tr><td>";
  44. print "<p> </p>";
  45. print "<p align='center'><input type='submit' value='Wyślij dane' >";
  46. print "</font>";
  47. print "<INPUT TYPE='reset' VALUE='Wyczyść dane' >";
  48. print "</td></tr>";
  49. echo "</form>"; 
  50. print "</table>";
  51. ?>




THX
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 10:44