I cannot select a row to edit in the repearter. How can i update correctly to the database?
Thank you

<?php do { ?>
     <tr> 
     <td height="42" bgcolor="#FFFF99"><div align="center"><?php echo $row_Recordset1['student_e']; ?></div></td>
      <td bgcolor="#FFFF99">

      <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
        &nbsp; Present
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="present" value="1" />
        </label>
        Late
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"2"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="late" value="2" />
        </label>
        Leave Early 
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"3"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="early" value="3" />
        </label>
        Absent 
        <label>
<input  <?php if (!(strcmp($row_Recordset1['present_time'],"4"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="absent" value="4" />
        </label>
        <input type="submit" name="submit" id="sumbit" value="sumbit" />
        <input type="hidden" name="MM_update" value="form1" />
      </form>
      </td>

Welcome to daniweb and let me be the first to say please explain your questions in greater detail with relavent code. From what I can understand you want us to fix your mysql query but I can't seem to see any mysql query in your code. Please post the relavent code for your problem and which by the looks of it includes a few lines below what you posted and possibly a few lines above what you posted. (include the mysql_query() function. Also it would be great if you could explain what you have tried to do in previous attempts so we can base our code on your mistakes taking away a lot of the guess work.

Hi, plz explain ur prob in detail. Also dnt paste ur code as it is in ur page. e.g. only post main code, dnt post table n it's syntax. so that other member can easily understand it.

i cannot update the record correctly,it update to another record.
THX

<?php require_once('Connections/pcssis.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;
}
}

$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 student_info SET present_time=%s WHERE id=%s",
                       GetSQLValueString($_POST['myradio'], "int"),
                       GetSQLValueString($_POST['myradio'], "int"));

  mysql_select_db($database_pcssis, $pcssis);
  $Result1 = mysql_query($updateSQL, $pcssis) or die(mysql_error());
}

$colname_Recordset1 = "-1";
if (isset($_GET['class'])) {
  $colname_Recordset1 = $_GET['class'];
}
mysql_select_db($database_pcssis, $pcssis);
$query_Recordset1 = sprintf("SELECT * FROM student_info WHERE `class` = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $pcssis) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-image: url(image/bg.gif);
	text-align: center;
}
-->
</style></head>

<body>
<table width="700" height="42" border="1">
  <tr>
    <td width="200" height="42" bgcolor="#FFFF99">Class: <?php echo $row_Recordset1['class']; ?></td>
    <td width="500" bgcolor="#FFFF99"> <div align="right">Date: <?php echo date("dS F Y "); ?></div></td>
  </tr>
  <tr>
    <td width="200" height="42" bgcolor="#FFFF99"><div align="center">Student Name</div></td>
    <td width="500" bgcolor="#FFFF99"> <div align="center">Attendance</div></td>
  </tr>
  
    <?php do { ?>
     <tr> 
     <td height="42" bgcolor="#FFFF99"><div align="center"><?php echo $row_Recordset1['student_e']; ?></div></td>
      <td bgcolor="#FFFF99">

      <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
        &nbsp; Present
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="present" value="1" />
        </label>
        Late
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"2"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="late" value="2" />
        </label>
        Leave Early 
        <label>
          <input  <?php if (!(strcmp($row_Recordset1['present_time'],"3"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="early" value="3" />
        </label>
        Absent 
        <label>
<input  <?php if (!(strcmp($row_Recordset1['present_time'],"4"))) {echo "checked=\"checked\"";} ?> type="radio" name="myradio" id="absent" value="4" />
        </label>
        <input type="submit" name="submit" id="sumbit" value="sumbit" />
        <input type="hidden" name="MM_update" value="form1" />
      </form>
      </td>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  </tr>
</table>

</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.