Hello all,
I am working on a script that will update the record. Technically, I've divided the updating procedure into two scripts. One will show the only codes of all records with a checkboxes infront of them. A "continue" button will proceed for the further procedure i.e, the real updating procedure..
Ok, I guess that I have cleared the scenario. The problem is that I don't know or I'd say that I don't have a clear idea about the second script that will do the updating job.
Here is my first script.
<?php
if ($_POST['verify_epshpm']=="ok") {
echo <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">\n
<head>
<title>Tallentaminen sivu</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<br />
<br />
<br />
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="right" valign="top" bgcolor="#FFFFFF">
<img src="ktl.gif" alt="" width="286" height="69" /></td>
</tr>
</tbody>
</table>
<table align= "center">
<tbody>
<tr>
<td><form action="epshp_update.php" method ="post" />
<input type="hidden" name="verify_epshp_form" value ="ok" />
EOD;
$db_username = "student";
$db_password = "itk215";
$db_name = "itk215";
$mysql_link = mysql_connect( "localhost", "$db_username", "$db_password") or die( "Unable to connect to database server");
@mysql_select_db( "$db_name") or die( "Unable to select database");
$result = mysql_query("SELECT record_id,sairaanhoitopiiri,toimipaikkatyyppi,kuntayhtym,mukanahankkeessa,yksikko,paikkakoodi,sokerirasituskokeennytteenottopa,glukoosinmritysmenetelm,yhteyshenkilo,terveyskeskus,tkjatko,katuosoite,postiosoite,puhelin,toinenyhteyshenkilo,note,choice FROM ktl_epshp ORDER BY ktl_epshp.record_id");
$i=0;
while ($array = mysql_fetch_array($result)) {
echo <<<EOD
<table align = "center">
<tbody>
<tr>
<td>Paikkakoodi:</td>
EOD;
echo "<td>".$array['paikkakoodi']."</td>";
printf ('<td><input type="checkbox" name="del[' . $i . ']" value=' . $array[record_id] . '></td>');
$i++;
echo <<<EOD
</tr>
</tbody>
</table>
EOD;
}
echo <<<EOD
<td><input type="submit" value="Continue" /></td>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
</body>
</html>
EOD;
}
else {
echo "can't access directly";
}
?>
As you can see that the next script is epshp_update.php.
I have these questions in my mind:
If my this script will fetch all 6 records and if I click 5 records to update, how can I send those 5 records (or array of 5 records) to the next page?
The next page will display me those 5 FULL records in the forms. I will put "UPDATE" button with every record. Is this approach OK or shld I have one UPDATE button for all records? If yes, how to do that?
Comming back to the first question. Should I allow user to select only one record or all 6 records? If one record, how to do that since my script is displaying checkboxes will all records and you can select multiple boxes, not one box
any suggestions and/or helping me with code?
Regards,
Taz