SitePoint Sponsor

User Tag List

Page 4 of 5 FirstFirst 12345 LastLast
Results 76 to 100 of 122
  1. #76
    SitePoint Zealot devscripts's Avatar
    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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  2. #77
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    needed to change
    "".$row[Date]."\">"; to
    "'.$row[Date].'\">";

    now no error msgs

  3. #78
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    last one now..... shud work fine..

    <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  4. #79
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now it comes up with a msg saying it doesn't like this bit


    $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'];


    Notice: Undefined index: book in c:\program files\apache group\apache\htdocs\test.php on line 97

  5. #80
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now check ur database.
    if entries r beign deleted.
    "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)

  6. #81
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thats coz this form
    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action" value="submitted" />
    <input type="submit" name="submit" value="Submit Booking" />
    </form>

    doesnt have what u have called

    if (isset($_POST['action']) == 'submitted'){

    $RmID = $_POST['book']['roomid'];
    if ($RmID == '2'){
    "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)

  7. #82
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i will fix this for u also and post it 2 mins
    "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)

  8. #83
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nah they're not being deleted... the latest version from you still has some errors. but second one you gave me when i change

    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]."\">";

    this bits so it was '.$row[RoomID].'
    it had no errors but delete still didn't work

  9. #84
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all was needed was to join the last 2 forms into 1.

    <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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']) == '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)

  10. #85
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i had an error.... sorry. heres the latest

    <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=\"submitted\">";
    echo "<input type=\"submit\" name=\"submit2\" value=\"Delete\">";
    echo "</form>";

    }
    ?>
    </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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']) == '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)

  11. #86
    SitePoint Evangelist nick0161's Avatar
    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\zealotii.php on line 46

    still has some errors... ... hmmm you changed the while loop did you? the quotations are different

  12. #87
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now ur errors about the if() {}

    <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=\"submitted\">";
    echo "<input type=\"submit\" name=\"submit2\" value=\"Delete\">";
    echo "</form>";

    }
    ?>
    </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  13. #88
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i changed the while loop back to original what you sent to me...
    now no errors loading

    but when you select a row to be deleted

    Notice: Undefined index: book in c:\program files\apache group\apache\htdocs\testII.php on line 119

    same problem though to
    127 which is this section

    $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'];

  14. #89
    SitePoint Zealot devscripts's Avatar
    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=\"submitted\">";
    echo "<input type=\"submit\" name=\"submit2\" value=\"Delete\">";
    echo "</form>";

    }
    ?>
    </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  15. #90
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also won't submit.. and there are still to 2 delete buttons and 3 submit booking
    hmmm

  16. #91
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    damm try this now.

    <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=\"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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  17. #92
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm nah... invalid query...

    have you purposely used to while loops??

  18. #93
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the code was from ur original post. it had 2 while loops. all ive done is echo the form inside 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)

  19. #94
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    with the latest code i gave u..... u said invalid query and i found another small error
    change
    $date=$_POST["date"];
    $timestart=$_POST["timestart"];

    to single quoted

    $date=$_POST['date'];
    $timestart=$_POST['timestart'];
    "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)

  20. #95
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm mate... if you've had enough i wouldn't blame ya... you've been helping all day..
    i do apprecriate your time n effort mate...

  21. #96
    SitePoint Zealot devscripts's Avatar
    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=\"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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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)

  22. #97
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heheh i had two while loops because one was commented... oops... ill remove it

  23. #98
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try that one. dont worry bout me
    "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)

  24. #99
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CODE I GOT NOW... no errors except invalid queries. and doesn't delete... shows no errors though.... hmmm


    <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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>

  25. #100
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    forget that bit of code. it dont do nothing.

    i want u to view source using right click... and paste me the source code of the html of wot is produced before u hit delete button.
    "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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •