SitePoint Sponsor |
|
User Tag List
Results 101 to 122 of 122
Thread: deleting records with checkboxes
-
Oct 11, 2004, 21:34 #101
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
roomid wrong?
$roomid=$_POST['roomid'];
$date=$_POST['date'];
$timestart=$_POST['timestart'];
$sql = "DELETE FROM timetable WHERE RoomID='$roomid' AND Date='$date'
where?
-
Oct 11, 2004, 21:36 #102
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
does it echo u this line
echo "you would like to delete";
wen u hit delete?"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:36 #103
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
forget about roomid i deleted my post coz i misread.
"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:37 #104
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
this is the html code before delete is pressed
<table>
<tr>
<td>
<html><body bgcolor=#FFFFFF><br><hr noshade>
<table cellpadding=0 cellspacing=0 width=200>
<tr><td>
<table border=1>
<tr><td>RoomID</td>
<td>Date</td>
<td>Time_Start</td>
<td>Time_Finish</td>
<td>Persons_Inc</td>
<td>Guests</td>
<td>Delete?</td>
</tr>
<tr><td>BoardRoom</td><td>2004-10-20</td><td>04:00:00</td><td>05:00:00</td><td>amir mark</td><td>ELMO</td><td><input type="radio" value=".BoardRoom,2004-10-20,04:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.BoardRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.04:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form><tr><td>BoardRoom</td><td>2004-10-20</td><td>05:00:00</td><td>01:00:00</td><td>amir</td><td>ELMO</td><td><input type="radio" value=".BoardRoom,2004-10-20,05:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.BoardRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.05:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form></table></td><td> </td><td>
<form action="/zealotII.php " method="post">
RoomID: <br />
<select name="book[roomid]">
<option value="1">BoardRoom
<option value="2">SmallRoom
</select><br>
Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
Start Time : <input type="text" name="book[start_time]" /><br />
Finish Time: <input type="text" name="book[finish_time]" /><br />
Persons Included: <input type="text" name="book[persons_inc]" /><br />
Guests: <input type="text" name="book[guests]" /><br />
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
Invalid query
-
Oct 11, 2004, 21:40 #105
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeh both delete buttons show the test writing "you would like to delete"
-
Oct 11, 2004, 21:46 #106
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
the second delete button shud delete the row try it
"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:48 #107
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
found an error
ur html code says
<input type="hidden" name="roomid" value="'.BoardRoom.'">
<input type="hidden" name="date" value="'.2004-10-20.'">
<input type="hidden" name="timestart" value="'.05:00:00.'">
its got extra quotes."None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:49 #108
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
good news submit is working now... don't know y.. just decided to work...
bad new delete still doesn't work, and for how many entries are in the table determines how many delete buttons there are...
-
Oct 11, 2004, 21:52 #109
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
try this code
<table>
<tr>
<td>
<?php
global $delete;
global $submit;
global $eventid;
global $del;
global $record;
if (isset($_POST['action'])){
$enventid = "2004-10-20";}
else{
//$enventid = $_GET['eventid'];
$enventid = "2004-10-20";
}
echo "<html><body bgcolor=#FFFFFF>";
//echo "<form method=\"POST\" action=\"testresults.php\">";
$db = mysql_connect("localhost","root");//,"password");
//mysql_select_db("database",$db);
mysql_select_db("t1",$db);
$sql = "SELECT * from timetable where Date='$enventid'";
$result = mysql_query($sql, $db) or die ("Invalid query");
?>
<br><hr noshade>
<table cellpadding=0 cellspacing=0 width=200>
<tr><td>
<table border=1>
<tr><td>RoomID</td>
<td>Date</td>
<td>Time_Start</td>
<td>Time_Finish</td>
<td>Persons_Inc</td>
<td>Guests</td>
<td>Delete?</td>
</tr>
<?php
while ($row = mysql_fetch_array($result)){
echo "<tr><td>".$row['RoomID']."</td><td>";
echo "".$row['Date']."</td><td>";
echo "".$row['Time_Start']."</td><td>";
echo "".$row['Time_Finish']."</td><td>";
echo "".$row['Persons_inc']."</td><td>";
echo "".$row['Guests']."</td><td>";
echo "<input type=\"radio\" value=\".$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";
echo "<form method =\"POST\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<input type=\"hidden\" name=\"roomid\" value=\"".$row['RoomID']."\">";
echo "<input type=\"hidden\" name=\"date\" value=\"".$row['Date']."\">";
echo "<input type=\"hidden\" name=\"timestart\" value=\"".$row['Time_Start']."\">";
echo "<input type=\"hidden\" name=\"action2\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit2\" value=\"Delete\">";
echo "</form>";
}
?>
</table></td><td> </td><td>
<form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post">
RoomID: <br />
<select name="book[roomid]">
<option value="1">BoardRoom
<option value="2">SmallRoom
</select><br>
Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
Start Time : <input type="text" name="book[start_time]" /><br />
Finish Time: <input type="text" name="book[finish_time]" /><br />
Persons Included: <input type="text" name="book[persons_inc]" /><br />
Guests: <input type="text" name="book[guests]" /><br />
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<?php
if (isset($_POST['action']) && $_POST['action'] == 'submitted'){
$RmID = $_POST['book']['roomid'];
if ($RmID == '2'){
$RoomID = "SmallRoom";}
else { $RoomID = "BoardRoom";}
$Date = $_POST['book']['date'];
$Time_Start = $_POST['book']['start_time'];
$Time_Finish = $_POST['book']['finish_time'];
$Persons_inc = $_POST['book']['persons_inc'];
$Guests = $_POST['book']['guests'];
$sql = "INSERT INTO timetable (RoomID,Date,Time_Start,Time_Finish,Persons_inc,Guests) VALUES('$RoomID','$Date','$Time_Start','$Time_Finish','$Persons_inc','$Guests' )";
$result = mysql_query($sql, $db) or die ("Invalid query");
echo "<b>Submission Added</b><br><br>";
}
if (isset($_POST['action2']) && $_POST['action2'] == 'submitted'){
$roomid=$_POST['roomid'];
$date=$_POST['date'];
$timestart=$_POST['timestart'];
$sql = "DELETE FROM timetable WHERE RoomID='$roomid' AND Date='$date' AND Time_Start='$timestart'";
echo "you would like to delete";
$result = mysql_query($sql, $db) or die ("Invalid query");
}
?>
</tr></table>"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:55 #110
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Winner!!!!
-
Oct 11, 2004, 21:56 #111
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
well sort of it doesn't delete what you select just the bottom row...
-
Oct 11, 2004, 21:58 #112
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
all works now? except ur insert also has many errors.
"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:59 #113
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i want u to giove me the output html again before u hit delete.
"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 21:59 #114
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
my insert?
submission works fine
delete only delete's whatever the bottom row is...
-
Oct 11, 2004, 22:00 #115
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry i was wrong.. it depends which layer of buttons you get... but that's cool... if i put them in the table... then it'll be fine
-
Oct 11, 2004, 22:01 #116
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
and you have to press delete twice...
-
Oct 11, 2004, 22:02 #117
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
and you have to press delete twice...but that's sweet.. hmm sounds like an error checking method... hehehe
thanks so much mate... been really helpful
-
Oct 11, 2004, 22:02 #118
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
here's the html
<table>
<tr>
<td>
<html><body bgcolor=#FFFFFF><br><hr noshade>
<table cellpadding=0 cellspacing=0 width=200>
<tr><td>
<table border=1>
<tr><td>RoomID</td>
<td>Date</td>
<td>Time_Start</td>
<td>Time_Finish</td>
<td>Persons_Inc</td>
<td>Guests</td>
<td>Delete?</td>
</tr>
<tr><td>BoardRoom</td><td>2004-10-20</td><td>04:00:00</td><td>05:00:00</td><td>amir mark</td><td>ELMO</td><td><input type="radio" value=".BoardRoom,2004-10-20,04:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.BoardRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.04:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form><tr><td>SmallRoom</td><td>2004-10-20</td><td>04:00:00</td><td>05:00:00</td><td>ernie</td><td>bert</td><td><input type="radio" value=".SmallRoom,2004-10-20,04:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.SmallRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.04:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form><tr><td>BoardRoom</td><td>2004-10-20</td><td>05:00:00</td><td>01:00:00</td><td>amir</td><td>ELMO</td><td><input type="radio" value=".BoardRoom,2004-10-20,05:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.BoardRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.05:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form><tr><td>BoardRoom</td><td>2004-10-20</td><td>06:00:00</td><td>00:00:00</td><td></td><td></td><td><input type="radio" value=".BoardRoom,2004-10-20,06:00:00" name="delete"></td></tr><form method ="POST" action="/zealotII.php"><input type="hidden" name="roomid" value="'.BoardRoom.'"><input type="hidden" name="date" value="'.2004-10-20.'"><input type="hidden" name="timestart" value="'.06:00:00.'"><input type="hidden" name="action2" value="submitted"><input type="submit" name="submit2" value="Delete"></form></table></td><td> </td><td>
<form action="/zealotII.php " method="post">
RoomID: <br />
<select name="book[roomid]">
<option value="1">BoardRoom
<option value="2">SmallRoom
</select><br>
Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
Start Time : <input type="text" name="book[start_time]" /><br />
Finish Time: <input type="text" name="book[finish_time]" /><br />
Persons Included: <input type="text" name="book[persons_inc]" /><br />
Guests: <input type="text" name="book[guests]" /><br />
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
</tr></table>
-
Oct 11, 2004, 22:04 #119
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok lol im off to bed.... before i go ill leave u with this link... its a small tutorial but u will learn fast from it.
http://www.phpfreaks.com/tutorials/33/0.php
also i noticed ur from australia... can u tell me wot time is it in NSW part of australia if u know?"None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 22:06 #120
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
it would be 2:35 here so it would be 3:05pm there... thanks so much mate...
yeh i'll check out ya link after i eat.... so hungry hehehe...
thanks mate
where are you from?
-
Oct 11, 2004, 22:08 #121
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
uk. gonna go sleep now. c u later
check out www.islamway.com)
ill help u more tommorow or something. good luck with ur work experience and thanks for telling me the time for NSW.
salaamz."None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)
-
Oct 11, 2004, 22:10 #122
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
no worries mate...
thanks again for all you help..
.
Bookmarks