Witam.
Zrobiłem dwa pliki. W jednym jest tabela z użytkownikami a druga to tabela z wyświetlonym rekordem.Poprostu przyznam się że nie wiem jak wysłać zaznaczone rekordy do drugiej tabeli. Przepraszam z góry za tak olbrzymi kod ale chcę dokładnie wiedzieć gdzie jest przyczyna.
  1. <?php require_once('../Connections/myconn.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. if (PHP_VERSION < 6) {
  7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8. }
  9.  
  10. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12. switch ($theType) {
  13. case "text":
  14. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15. break;
  16. case "long":
  17. case "int":
  18. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19. break;
  20. case "double":
  21. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22. break;
  23. case "date":
  24. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25. break;
  26. case "defined":
  27. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28. break;
  29. }
  30. return $theValue;
  31. }
  32. }
  33.  
  34. $maxRows_Recordset1 = 10;
  35. $pageNum_Recordset1 = 0;
  36. if (isset($_GET['pageNum_Recordset1'])) {
  37. $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
  38. }
  39. $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
  40.  
  41. mysql_select_db($database_myconn, $myconn);
  42. $query_Recordset1 = "SELECT user_id, firstname, lastname, username FROM userlogin";
  43. $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
  44. $Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error());
  45. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  46.  
  47. if (isset($_GET['totalRows_Recordset1'])) {
  48. $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
  49. } else {
  50. $all_Recordset1 = mysql_query($query_Recordset1);
  51. $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
  52. }
  53. $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
  54. ?>
  55. <form action="phplist.php" method="get">
  56. <table width="200" border="1" align="center">
  57. <tr>
  58. <td>Oznacz</td>
  59. <td>ID</td>
  60. <td>Imie</td>
  61. <td>Nazwisko</td>
  62. <td>Nick</td>
  63. </tr>
  64. <?php do { ?>
  65. <tr>
  66. <td><input name="checkbox" type="checkbox" id="checkbox" value="<?php echo $row_Recordset1['user_id']; ?>">
  67. <label for="checkbox"></label></td>
  68. <td><?php echo $row_Recordset1['user_id']; ?></td>
  69. <td><?php echo $row_Recordset1['firstname']; ?></td>
  70. <td><?php echo $row_Recordset1['lastname']; ?></td>
  71. <td><?php echo $row_Recordset1['username']; ?></td>
  72. </tr>
  73. <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  74. </table>
  75. <input type="submit" name="button" id="button" value="Edit">
  76. <input type="hidden" name="hiddenField" id="hiddenField">
  77. </form>
  78. <?php
  79. mysql_free_result($Recordset1);
  80. ?>
  81.  

Jak zrobic że jak zaznaczę rekordy za pomocą checkboxa pokazały się tylko te rekordy które są zaznaczone?
Zgóry dzięki za pomoc
  1. <?php require_once('../Connections/myconn.php'); ?><?php
  2. if (!function_exists("GetSQLValueString")) {
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5. if (PHP_VERSION < 6) {
  6. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7. }
  8.  
  9. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  10.  
  11. switch ($theType) {
  12. case "text":
  13. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14. break;
  15. case "long":
  16. case "int":
  17. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18. break;
  19. case "double":
  20. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  21. break;
  22. case "date":
  23. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24. break;
  25. case "defined":
  26. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27. break;
  28. }
  29. return $theValue;
  30. }
  31. }
  32.  
  33. $maxRows_DetailRS1 = 10;
  34. $pageNum_DetailRS1 = 0;
  35. if (isset($_GET['pageNum_DetailRS1'])) {
  36. $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
  37. }
  38. $startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
  39.  
  40. $colname_DetailRS1 = "-1";
  41. if (isset($_GET['recordID'])) {
  42. $colname_DetailRS1 = $_GET['recordID'];
  43. }
  44. mysql_select_db($database_myconn, $myconn);
  45. $query_DetailRS1 = sprintf("SELECT * FROM userlogin WHERE user_id = %s", GetSQLValueString($colname_DetailRS1, "int"));
  46. $query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
  47. $DetailRS1 = mysql_query($query_limit_DetailRS1, $myconn) or die(mysql_error());
  48. $row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
  49.  
  50. if (isset($_GET['totalRows_DetailRS1'])) {
  51. $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
  52. } else {
  53. $all_DetailRS1 = mysql_query($query_DetailRS1);
  54. $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
  55. }
  56. $totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
  57. ?>
  58.  
  59. <table border="1" align="center">
  60. <tr>
  61. <td>user_id</td>
  62. <td><?php echo $row_DetailRS1['user_id']; ?></td>
  63. </tr>
  64. <tr>
  65. <td>firstname</td>
  66. <td><?php echo $row_DetailRS1['firstname']; ?></td>
  67. </tr>
  68. <tr>
  69. <td>lastname</td>
  70. <td><?php echo $row_DetailRS1['lastname']; ?></td>
  71. </tr>
  72. <tr>
  73. <td>username</td>
  74. <td><?php echo $row_DetailRS1['username']; ?></td>
  75. </tr>
  76. <tr>
  77.  
  78. </table>
  79. </body>
  80. </html><?php
  81. mysql_free_result($DetailRS1);
  82. ?>


CZy jest ktoś taki który pomoże rozwiązać problem?