Re: Updateing a SQL select populated form
- From: bangsundara@xxxxxxxxx
- Date: Sat, 5 Apr 2008 22:15:57 -0700 (PDT)
On 4月6日, 午前3:52, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> 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
.
- Follow-Ups:
- Re: Updateing a SQL select populated form
- From: Jerry Stuckle
- Re: Updateing a SQL select populated form
- References:
- Re: Updateing a SQL select populated form
- From: bangsundara
- Re: Updateing a SQL select populated form
- From: Jerry Stuckle
- Re: Updateing a SQL select populated form
- Prev by Date: Re: PHP Manual with Notes (chm)
- Next by Date: Other Jacques Lemans Watches Replica - Jacques Lemans Watches Cheap
- Previous by thread: Re: Updateing a SQL select populated form
- Next by thread: Re: Updateing a SQL select populated form
- Index(es):
Relevant Pages
|