Afficher un message
Vieux 06/04/2008, 07h15   #6
bangsundara@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Updateing a SQL select populated form

>>On 4$B7n(B6$BF|(B, $B8aA0(B3:52, Jerry Stuckle <jstuck...@attglobal.net> wrote:

Thank you very much for your kind reply.
as per your advice, i made simple php like below pg,

now i have 2 doubt.

1.when i read a data to check box from database, how can i set
cheked when data is 1 not checked when data is 0.

Then
2. After displaying the data, whe the user clicked, then
date field can be entered, if not previous ino is retained
then the update whereever the user changed the checkbox and
date field onlt those info should be updated.

here is the sample code wher i have done till now

--------------------------
<?php
// connect to the database :mysql
$host="localhost"; // Host name.
$dbuser="test"; // MySQL username.
$dbpassword="******"; // MySQL password.
$database="test"; // Database name.
mysql_connect($host,$dbuser,$dbpassword) or die('Unable to connect to
thye database');
mysql_select_db($database) or die("Unable to select database");
$result = mysql_query("SELECT * FROM tbltest ORDER BY slno,empid");
$i = 0;

print "<form name='namestoupdate' method='post' action='tblupdate.php'>
\n";
print "<tr>";
print "<th nowrap> No</th>";
print "<th nowrap> Emp No</th>";
print "<th nowrap> Emp Name</th>";
print "<th nowrap> Amount</th>";
print "<th nowrap> Flg </th>";
print "<th nowrap> Date</th>";

while ($rec = mysql_fetch_array($result)) {
print "<input type='hidden' name='slno[$i]'
value='{$rec['slno']}' />";
print "<tr>";
print "<p>{$rec['slno']} {$rec['empid']} {$rec['empname']}
{$rec['amt']} <input type='checkbox' name='{$rec['slno']}'
value='{$rec['flg']}'> <input type='text' size='25' name='rec[$i]'
value='{$rec['date']}' /></p> ";
++$i;
}
print "</table>";
print "<p><input type='submit' value='ClickallChkbox' /></p>";
print "<input type='submit' value=' Clear' />";
print "<p><input type='submit' value='Update' /></p>";
print "</form>";
mysql_close();
?>
-------------------------


Thanki you very much in advance

-evolu
  Réponse avec citation
 
Page generated in 0,06554 seconds with 9 queries