By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

i want to use the check box to delete when clicked

P: 1
hi
im writing a php scrib and i'm new to this
i want to delete informatiom from sql when the user click the check box.how can i do this.
here is the code of the tabel:
<?php

$db = mysql_connect("localhost", "contacts","gotocme");
mysql_select_db("intranet",$db);

$result = mysql_query("SELECT CMEer, rfrom, till FROM reservation where rdate = '$resdate' AND type = 'conference' ",$db);
//if ($myrow = mysql_fetch_array($result)) {
echo "\n";
echo "<tr BGCOLOR='yellow' class='header'><td>";?>
<img src="../images/yex.gif" width="25" height="24" /> <?php echo "</td><td>CMEer</td><td>from</td><td>Till</td>\n";

while ($myrow = mysql_fetch_row($result)) {

printf("<tr class='tables'>"); ?>
</p><td><input type="checkbox" name="checkbox2" value="checkbox" /></td>
<?php
printf("<td>%s</td> <td>%s</td> <td>%s</td> </tr>\n", $myrow[0], $myrow[1], $myrow[2]); }

echo "</table>\n";
mysql_close();
?>



thanks
Aug 7 '07 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
hi
im writing a php scrib and i'm new to this
i want to delete informatiom from sql when the user click the check box.how can i do this.
here is the code of the tabel:
<?php

$db = mysql_connect("localhost", "contacts","gotocme");
mysql_select_db("intranet",$db);

$result = mysql_query("SELECT CMEer, rfrom, till FROM reservation where rdate = '$resdate' AND type = 'conference' ",$db);
//if ($myrow = mysql_fetch_array($result)) {
echo "\n";
echo "<tr BGCOLOR='yellow' class='header'><td>";?>
<img src="../images/yex.gif" width="25" height="24" /> <?php echo "</td><td>CMEer</td><td>from</td><td>Till</td>\n";

while ($myrow = mysql_fetch_row($result)) {

printf("<tr class='tables'>"); ?>
</p><td><input type="checkbox" name="checkbox2" value="checkbox" /></td>
<?php
printf("<td>%s</td> <td>%s</td> <td>%s</td> </tr>\n", $myrow[0], $myrow[1], $myrow[2]); }

echo "</table>\n";
mysql_close();
?>



thanks
1.) Please use code tags when posting code.
2.) That code is for displaying the values only. You want the delete to occur when the checkbox is clicked or when the page is sibmitted?
3.) Just pass the the primary key of the record that is selected to the delete script/function (you'll need to write that one).
Aug 7 '07 #2

P: 7
hi
im writing a php scrib and i'm new to this
i want to delete informatiom from sql when the user click the check box.how can i do this.
here is the code of the tabel:
<?php

$db = mysql_connect("localhost", "contacts","gotocme");
mysql_select_db("intranet",$db);

$result = mysql_query("SELECT CMEer, rfrom, till FROM




You should learn javascript then u can handle events those user click on the
check box the event trigger and action done by that javascript ...
javascript event internally trigger your action script in php those delete ur record from the table.....................
Aug 7 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.