logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 08-18-2013, 07:15 AM   #1
badziol1
 
Join Date: Aug 2013
Posts: 1
Default How to display the selected checkbox on the new site?

Welcome.
I've created a table with downloading users and I want to when you select the check box that you selected userzy shown on a new page. How to do it? Please help me.
* Here is the code
Code:
<?php require_once('../Connections/myconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  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;

mysql_select_db($database_myconn, $myconn);
$query_Recordset1 = "SELECT user_id, firstname, lastname, username FROM userlogin";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$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>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  </table>
  <input type="submit" name="button" id="button" value="Edit">
  <input type="hidden" name="hiddenField" id="hiddenField">
</form>
<?php
mysql_free_result($Recordset1);
?>

Last edited by edbr; 08-20-2013 at 02:45 AM..
badziol1 is offline   Reply With Quote
Old 08-20-2013, 01:38 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

on submit they will be directed in this case to phplist.php.
I would on that page use it to select the correct data.
I would use $_POST rather than get
then use $_POST[' whatever'] (what ever the value is in reality)
match it to your database or redirect to maybe a registration page if not in the database
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 08-20-2013, 02:42 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

another point , using a checkbox like you do , will mean upon need to get in to arrays, so you might want to re think that approach
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com