Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Wyświetlenie komunikatu., Musisz zaznaczyć checkbox.
woxala123
post 6.11.2016, 13:03:06
Post #1





Grupa: Zarejestrowani
Postów: 361
Pomógł: 12
Dołączył: 9.01.2010

Ostrzeżenie: (10%)
X----


Jak zrobic żeby user musi zaznaczyć checkbox by móc wysłać formularz do edycji. Chodzi mi o komunikat jak wysyła niezaznaczone checboxy.
Oto kod
  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. mysql_select_db($database_myconn, $myconn);
  35. $query_Recordset1 = "SELECT * FROM userlogin";
  36. $Recordset1 = mysql_query($query_Recordset1, $myconn) or die(mysql_error());
  37. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  38. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  39. ?>
  40. <form name="form1" method="post" action="edit_user.php">
  41. <table border="1" cellpadding="1" cellspacing="1">
  42. <tr>
  43. <td>Oznacz</td>
  44. <td>user_id</td>
  45. <td>firstname</td>
  46. <td>lastname</td>
  47. <td>username</td>
  48. <td>password</td>
  49. <td>email</td>
  50. <td>dateregister</td>
  51. <td>lastlogin</td>
  52. <td>active</td>
  53. <td>COLOR</td>
  54. <td>ip</td>
  55. </tr>
  56. <?php do { ?>
  57. <tr>
  58. <td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row_Recordset1['user_id']; ?>">
  59. <label for="checkbox[]"></label></td>
  60. <td><?php echo $row_Recordset1['user_id']; ?></td>
  61. <td><?php echo $row_Recordset1['firstname']; ?></td>
  62. <td><?php echo $row_Recordset1['lastname']; ?></td>
  63. <td><?php echo $row_Recordset1['username']; ?></td>
  64. <td><?php echo $row_Recordset1['password']; ?></td>
  65. <td><?php echo $row_Recordset1['email']; ?></td>
  66. <td><?php echo $row_Recordset1['dateregister']; ?></td>
  67. <td><?php echo $row_Recordset1['lastlogin']; ?></td>
  68. <td><?php echo $row_Recordset1['active']; ?></td>
  69. <td><?php echo $row_Recordset1['COLOR']; ?></td>
  70. <td><?php echo $row_Recordset1['ip']; ?></td>
  71. </tr>
  72. <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  73. </table>
  74. <input type="submit" name="submit" id="submit" value="Wyślij">
  75. </form>
  76. <?php
  77. mysql_free_result($Recordset1);
  78. ?>
  79.  
  80.  
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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 12:40