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.
<?php require_once('../Connections/myconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$query_Recordset1 = "SELECT user_id, firstname, lastname, username FROM userlogin";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?>
<form action="phplist.php" method="get">
<table width="200" border="1" align="center">
<tr>
<td>Oznacz</td>
<td>ID</td>
<td>Imie</td>
<td>Nazwisko</td>
<td>Nick</td>
</tr>
<?php do { ?>
<tr>
<td><input name="checkbox" type="checkbox" id="checkbox" value="
<?php echo $row_Recordset1['user_id']; ?>">
<label for="checkbox"></label></td>
<td>
<?php echo $row_Recordset1['user_id']; ?></td>
<td>
<?php echo $row_Recordset1['firstname']; ?></td>
<td>
<?php echo $row_Recordset1['lastname']; ?></td>
<td>
<?php echo $row_Recordset1['username']; ?></td>
</tr>
</table>
<input type="submit" name="button" id="button" value="Edit">
<input type="hidden" name="hiddenField" id="hiddenField">
</form>
<?php
?>
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
<?php require_once('../Connections/myconn.php'); ?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_DetailRS1 = 10;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) { $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) { $colname_DetailRS1 = $_GET['recordID'];
}
$query_DetailRS1 = sprintf("SELECT * FROM userlogin WHERE user_id = %s", GetSQLValueString
($colname_DetailRS1, "int")); $query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
if (isset($_GET['totalRows_DetailRS1'])) { $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1; ?>
<table border="1" align="center">
<tr>
<td>user_id</td>
<td>
<?php echo $row_DetailRS1['user_id']; ?></td>
</tr>
<tr>
<td>firstname</td>
<td>
<?php echo $row_DetailRS1['firstname']; ?></td>
</tr>
<tr>
<td>lastname</td>
<td>
<?php echo $row_DetailRS1['lastname']; ?></td>
</tr>
<tr>
<td>username</td>
<td>
<?php echo $row_DetailRS1['username']; ?></td>
</tr>
<tr>
</table>
</body>
</html><?php
?>
CZy jest ktoś taki który pomoże rozwiązać problem?
Ten post edytował woxala123 2.08.2013, 19:19:39