I don't know of a different way to do this. I was trying to figure out a way to maybe refresh the page and with refreshing then delete the entries from the data base using php. I am willing to do this a differnet way. But I'm a beginner at javascript and I can do what I need to with PHP. Thanks.
<?php require "useraccess.php";
$email=$_COOKIE["dummiesemail"];
include('PUCheader.php');
?>
<?php
$db_host = 'localhost';
$db_user = 'School';
$db_pwd = 'school';
$database = 'school';
$table = 'location';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
$result = mysql_query("SELECT * FROM {$table} WHERE email = '$email' AND RequestDate >= CURDATE() ORDER BY RequestDate, RequestTime ");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<center>";
echo "<table border='1'>";
echo "<tr><th> </th><th> Date </th> <th> Time </th><th> Pick Up Location </th><th> Destination </th><th> Name </th></tr>";
while($row = mysql_fetch_array($result)){
$time =$row['time'];
$ID=$row['Index'];
echo "<tr><td>";
print "<center><form><input type=\"checkbox\" name=\"nID[]\" value=\"vID[]\" onclick=\"del(this)\" ></form></center>";
echo "</td><td>";
echo $row['RequestDate'];
echo "</td><td>";
echo $row['RequestTime']. " " .$time;
echo "</td><td>";
if($row['bStreetNum'] == 0 && $row['bStreetAdd'] == null && $row['bCity'] == null &&$row['bZip'] == 0){
echo $row['slStart'];
echo "</td>";
}
else{
echo $row['bStreetNum'] . " "; echo $row['bStreetAdd'] . ", "; echo $row['bCity'] . " "; echo $row['bZip'];
echo "</td>";
}
echo "<td>";
if($row['dStreetNum'] == 0 && $row['dStreetAdd'] == null && $row['dCity'] == null &&$row['dZip'] == 0){
echo $row['dDest'];
echo "</td>";
}
else{
echo $row['dStreetNum'] . " "; echo $row['dStreetAdd'] . ", "; echo $row['dCity'] . " "; echo $row['dZip'];
echo "</td>";
//echo "</td><td>";
}
echo "<td>";
$email = $row['email'];
$resultname = mysql_query("SELECT Name from school.login where email = '$email'");
$disName = mysql_fetch_array($resultname);
//if($email == $disName['Name']){
echo $disName['Name'];
// }
echo "</td></tr>";
}
echo "</table>";
echo "</center>";
?>
<b>To cancel a ride request:<br> 1.) Check the box for the request to cancel.<br> 2.) Click the Cancel button.<br><br></b>
<input type= "button" value ="Cancel" name="Cancel" onclick ="clk = true; clickbutton();" >
<br><br>
<INPUT TYPE="button" VALUE="Back" onclick="history.go(-1);return true;">
<bb>
<input type=button onclick="location.href='ScheduleMap.php'" value='Todays Schedule'>
<script language= "javascript">
clk = false;
checked = false;
function del(f) {
if(f.checked){
//alert("delete");
return checked = true;
}
else return checked = false;
}
function clickbutton(){
if(clk == true){
if(checked == true){
alert("checked then clicked");
//function for deleting from mysql entry
}
}
}
//funciton to delete
</script>
<?php
// include the page footer
include('PUCfooter.php');
?>

New Topic/Question
Reply




MultiQuote



|