Witam!
Mam dwa pliki. Pierwszy jest do wybierania userów do edytowania a drugi do odbioru zaznaczonych userów i aktualizowania ich. Problem polega na tym że jak wstawię "powtórz region"
to owszem pokazuje zaznaczonych userów ale nie chce ich aktualizować. Gdzie tkwi szczegół. Przy braku "powtórz region" owszem aktualizuje tylko jednego bo wiadomo wyświetli tylko jednego a nie więcej. pliki to edit.php i t1.php Bardziej oczekuje nakierowania w pliku t1.php
http://wklej.to/2VaQ0 a tu drugi plik edit.php do zaznaczania
http://wklej.to/3oqKz .
pozdrawiam
<?php require_once('../Connections/local.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE userlogin SET firstname=%s, lastname=%s, username=%s, password=%s, email=%s WHERE user_id=%s", GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['lastname'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['user_id'], "int"));
$updateGoTo = "edit.php";
if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ?
"&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING'];
}
}
$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 * 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;
$colname_Recordset1 = "-1";
if (isset($_POST['user_id'])) { $colname_Recordset1 = $_POST['user_id'];
}
$query_Recordset1 = sprintf("SELECT user_id, firstname, lastname, username, password, email FROM userlogin WHERE user_id = %s", GetSQLValueString
($colname_Recordset1, "int")); $query_Recordset1 = sprintf("SELECT * FROM userlogin WHERE user_id = %s", GetSQLValueString
($colname_Recordset1, "int")); $query_Recordset1 = "SELECT user_id, firstname, lastname, username, password,email,dateregister,lastlogin,active FROM userlogin WHERE user_id IN (".implode(',',$_POST['checkbox']).")"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dokument bez tytułu</title>
</head>
<body>
<form action="
<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<?php do { ?>
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">User_id:</td>
<td>
<?php echo $row_Recordset1['user_id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Firstname:</td>
<td><input type="text" name="firstname" value="
<?php echo htmlentities($row_Recordset1['firstname'], ENT_COMPAT
, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Lastname:</td>
<td><input type="text" name="lastname" value="
<?php echo htmlentities($row_Recordset1['lastname'], ENT_COMPAT
, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Username:</td>
<td><input type="text" name="username" value="
<?php echo htmlentities($row_Recordset1['username'], ENT_COMPAT
, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Password:</td>
<td><input type="text" name="password" value="
<?php echo htmlentities($row_Recordset1['password'], ENT_COMPAT
, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="
<?php echo htmlentities($row_Recordset1['email'], ENT_COMPAT
, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Uaktualnij rekord" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="user_id" value="
<?php echo $row_Recordset1['user_id']; ?>" />
</form>
<p> </p>
</body>
</html>
<?php
?>
Witam.
Czy jest ktos w stanie ten temat ruszyć?
Pozdrawiam
Ten post edytował woxala123 15.01.2016, 23:36:22