SitePoint Sponsor |
|
User Tag List
Results 51 to 75 of 122
Thread: deleting records with checkboxes
-
Oct 11, 2004, 19:57 #51
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i changed </form> to echo "</form>"; and got
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\apache group\apache\htdocs\delrecord.php on line 77
which is just a commented line...
by the way i do really appreciate all the help you've given... many thx
-
Oct 11, 2004, 19:58 #52
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hmmmm i think if i taught u how to do this so u forget that tutorial it wud have been better for you all this time lol.
i dunno wot to do now. i feel really bad. if u still want to go on paste ur code again :P i dont give up that easily BUT if u r too tired then i will leave u with a small tutorial here of my own so u understand how the values r passed through. its upto you.
does the parse error say enexpected soemthing?"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, 19:59 #53
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
paste me ur code now :P
"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, 20:01 #54
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hehehe yeh...
don't feel bad mate.. you've helped me heaps....i've kept your code.. heheh i'm not too tired... i'm at work... hehehe... i'm doing work experience... what's the small tutorial of,this is the error msg
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\apache group\apache\htdocs\delrecord.php on line 77
and the submit form gives the same result... so i'm presuming one error for two things is better than one each for each thing...
-
Oct 11, 2004, 20:02 #55
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<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>";
*/
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>";
// here echo the form like this....
echo "<form method =\"POST\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<input type=\"hidden\" name=\"action\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit Booking\">";
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=\"submitted2\">";
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 />
<br />
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action2" value="submitted2" />
<input type="submit" name="submit2" value="Delete" />
</form>
*/
?>
<?php
if (isset($_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']) == 'submitted'){
$sql = "DELETE FROM timetable WHERE RoomID='$_POST["roomid"]' AND Date='$_POST["date"]' AND Time_Start='$_POST["timestart"]'";
echo "you would like to delete";
//$array = explode(",",$delete);
//print_r($array);
//$sql = "DELETE FROM timetable WHERE RoomID='$array[0]' AND Date='$array[1]' AND Time_Start='$array[2]'";
//$sql = "DELETE FROM timetable WHERE RoomID='$row[RoomID]' AND Date='$row[Date]' AND Time_Start='$row[Time_Start]'";
//$sql = "DELETE FROM timetable WHERE RoomID=$RoomID' AND Date='$Date' AND Time_Start='$Time_Start'";
$result = mysql_query($sql, $db) or die ("Invalid query");
}
?>
</tr></table>
-
Oct 11, 2004, 20:06 #56
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i'm confused whether i am meant to delete some or all of the html section after
//---------------------------------
-
Oct 11, 2004, 20:09 #57
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok few error first here
this form line forgot to close php with ?>
<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>"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, 20:11 #58
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
now tell me where the error is.
"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, 20:12 #59
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
it's hard to see but i commented that whole html section that was y i deleted ?>
what i meant to keep it... if i keep that html section i get a parse error on an empty line....
i get a parse error on line 41
which is a blank line before the commented while loop....
-
Oct 11, 2004, 20:13 #60
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
also get rid of
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action2" value="submitted2" />
<input type="submit" name="submit2" value="Delete" />
</form>
this form since we have it in the loop."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, 20:17 #61
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
still same error
-
Oct 11, 2004, 20:20 #62
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
try this code in a new file plz? i have removed some things errors. and let me know if u get errors and line numbers.
<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>";
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=\"action\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit Booking\">";
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=\"submitted2\">";
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 />
<br />
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<?php
if (isset($_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']) == '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, 20:23 #63
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i got a parse error on this line
</table></td><td> </td><td>
-
Oct 11, 2004, 20:27 #64
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
a ?> was missing after the while loop... now starting to at least get a picture...
this is the error now
Notice: Use of undefined constant RoomID - assumed 'RoomID' in c:\program files\apache group\apache\htdocs\zealot.php on line 57
Notice: Use of undefined constant Date - assumed 'Date' in c:\program files\apache group\apache\htdocs\zealot.php on line 58
Notice: Use of undefined constant Time_Start - assumed 'Time_Start' in c:\program files\apache group\apache\htdocs\test.php on line 59
-
Oct 11, 2004, 20:27 #65
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yup. i had forgot ?>
heres the full code again now we will fix it dont change anything until i say so :P
<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>";
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=\"action\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit Booking\">";
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=\"submitted2\">";
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 />
<br />
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<?php
if (isset($_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']) == '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, 20:28 #66
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
which are these lines
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]."\">";
-
Oct 11, 2004, 20:30 #67
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
parse error 128 on the last line of the script
-
Oct 11, 2004, 20:32 #68
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
caused by two while statements... (they were repeated now back to same error as before)
errors here with the $row[RoomID]." etc... says undefined constants..
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]."\">";
-
Oct 11, 2004, 20:33 #69
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
tell me the error msg. missing soemthing?
"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, 20:34 #70
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Notice: Use of undefined constant RoomID - assumed 'RoomID' in c:\program files\apache group\apache\htdocs\testii.php on line 57
Notice: Use of undefined constant Date - assumed 'Date' in c:\program files\apache group\apache\htdocs\testii.php on line 58
Notice: Use of undefined constant Time_Start - assumed 'Time_Start' in c:\program files\apache group\apache\htdocs\testii.php on line 59
-
Oct 11, 2004, 20:36 #71
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<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>";
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=\"action\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit Booking\">";
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=\"submitted2\">";
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 />
</form>
<br />
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<?php
if (isset($_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']) == '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, 20:39 #72
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
gettting there
<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>";
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=\"action\" value=\"submitted\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit Booking\">";
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=\"submitted2\">";
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 />
</form>
<br />
<form method = "POST" action="delrecord.php">
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Submit Booking" />
</form>
<?php
if (isset($_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']) == '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, 20:40 #73
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
was anything changed then? comes up with the same error... by the way i can actually see the forms too, and table.. and two delete and two submit bookings buttons
-
Oct 11, 2004, 20:43 #74
- Join Date
- Oct 2004
- Location
- australia
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
and in the table it has
notice: Use of undefined constant Date - assumed 'Date' in c:\program files\apache group\apache\htdocs\testii.php on line 47
but still shows correct data... this happens for all variables... (ie time-start)
-
Oct 11, 2004, 20:43 #75
- Join Date
- Sep 2004
- Location
- ur monitor
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
the latst one i gave u has changes. please save that one. and retry.. before that one i had only small change... the latest had big changes.
"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)
Bookmarks