<?php
require_once("connection to server.php");
?>
<link rel="stylesheet" type="text/css" media="all" href="niceforms-default.css"">
<table>
<?php
error_reporting (0);
mysql_select_db("leave_db");
$mysql="SELECT * FROM users WHERE Username='$_POST[nameEdit]'";
$result=mysql_query($mysql);
while($row=mysql_fetch_array($result)){
?>
<thead>
<tr>
<table width="100%" id="rounded-corner" summary="2007 Major IT Companies' Profit">
<tbody>
<td></td>
<td width="40%"><?php echo $row['Fname'];?> <?php echo $row['Lname'];?></td>
<td width="10%"><?php echo $row['Sex'];?></td>
<td width="20%"><?php echo $row['Nationality'];?></td>
<td width="20%"><?php echo $row['Role'];?></td>
<td width="10%"><img src="images/trash.png" alt="" title="" border="0" /></td>
</tbody>
</table>
<?php
}
?>
<?php
mysql_close();
?>
<?php
require_once "config.php";
if (isset($_GET['id'])){
$id = $_GET['id'];
$del=mysql_query("DELETE FROM users WHERE UserID ='$id'");
if($del){
echo "<p><span style='font-weight:bold; color:#0000FF; margin-left:150px;'>Successfully deleted</span></p>"; header("Location:delete_user.php");
}
else
echo "<p><span style='font-weight:bold; color:#FF0000; margin-left:150px;'>An Error while deleting ".mysql_error()."</span></p>";
}
?>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
that is my code and i want to delete data from my database it runs very well but does not delete data because i want to pick values that have been retrieved from the data base
Like
Name Username
Ian i234
so if one choses to delete using i234 it does not delete
You haven't included the code for delete_user.php.
I would also have a guess to say the following line is wrong:-
<td width="10%"><img src="images/trash.png" alt="" title="" border="0" /></td>
You can't just stick php inside html and expect it to work.
You will need to change it to the following.
<td width="10%"><img src="images/trash.png" alt="" title="" border="0" /></td>
Related
I have following page to confirm the deletion of table item by using bootstrap modal. When I click delete button, I can not see the modal div. What's my wrong?
<?php
$content = [0=>["news_id"=>1,"news_title"=>"Hürriyet","news_date"=>"Bugün","news_content"=>"siyaset"],
1=>["news_id"=>2,"news_title"=>"Milliyet","news_date"=>"Yarın","news_content"=>"ekonomi"],
2=>["news_id"=>3,"news_title"=>"Sabah","news_date"=>"Dün","news_content"=>"politika"]]
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function(){
$(".btn-show-modal").click(function(e){
e.preventDefault();
var id = $(this).attr('id');
var modal_id = "dialog-example_"+id;
$("#"+modal_id).modal('show');
});
$(".btn btn-danger").click(function(e) {
var id = $(this).attr('id');
var modal_id = "dialog-example_"+id;
$("#"+modal_id).modal('hide');
});
});
</script>
<div class="container">
<!-- Modal -->
<table class="table table-bordered">
<thead>
<tr>
<th width="60">ID</th>
<th width="200">Title</th>
<th width="150">Date Posted</th>
<th>Content</th>
<th width="200">Image</th>
<th width="200">Action</th>
</tr>
</thead>
<tbody>
<?php
foreach ($content as $row) {
?>
<tr>
<td><?php echo $row['news_id']; ?></td>
<td><?php echo $row['news_title']; ?></td>
<td><?php echo $row['news_date']; ?></td>
<td><?php echo $row['news_content']; ?></td>
<td><img style="height:50px; width:50px;" src="" ></td>
<td>
</span> Edit
<span class="glyphicon glyphicon-remove"></span> Delete
</td>
<div class="modal hide fade" id="dialog-example_<?php echo $row['news_id'] ?>">
<div class="modal-header">
<h5>Confirm Delete</h5>
</div>
<div class="modal-body">
<p class="modaltext">Are you sure you want to delete this record?</p>
</div>
<div class="modal-footer">
No
<a href="delete-project.php?code=<?php echo $row['news_id']; ?>"
class="btn btn-danger" id="<?php echo $row['news_id'] ;?>">Yes</a>
</div>
</div>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</body>
</html>
Because of this I can not see whether my code is running.
Working code!
I rewrote your modal and changed the way it opens to onclick="" functions for the button elements.
<?php
$content = [0=>["news_id"=>1,"news_title"=>"Hürriyet","news_date"=>"Bugün","news_content"=>"siyaset"],
1=>["news_id"=>2,"news_title"=>"Milliyet","news_date"=>"Yarın","news_content"=>"ekonomi"],
2=>["news_id"=>3,"news_title"=>"Sabah","news_date"=>"Dün","news_content"=>"politika"]]
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<!-- Modal -->
<table class="table table-bordered">
<thead>
<tr>
<th width="60">ID</th>
<th width="200">Title</th>
<th width="150">Date Posted</th>
<th>Content</th>
<th width="200">Image</th>
<th width="200">Action</th>
</tr>
</thead>
<tbody>
<?php
foreach ($content as $row) {
?>
<tr>
<td>
<?php echo $row['news_id']; ?>
</td>
<td>
<?php echo $row['news_title']; ?>
</td>
<td>
<?php echo $row['news_date']; ?>
</td>
<td>
<?php echo $row['news_content']; ?>
</td>
<td><img style="height:50px; width:50px;" src=""></td>
<td>
<a href="edit2.php?newsid=<?php echo $row['news_id'];?>" class='btn btn-info left-margin'>
<span class="glyphicon glyphicon-edit">Edit</span>
</a>
<a onclick="$('#dialog-example_<?php echo $row['news_id'] ?>').modal('show');" href="#" class='btn-show-modal' data-toggle="modal" title="Delede Record">
<span class="glyphicon glyphicon-remove"></span> Delete
</a>
</td>
<div id="dialog-example_<?php echo $row['news_id'] ?>" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" id="dialog-example_<?php echo $row['news_id'] ?>">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Confirm Delete</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this record?</p>
</div>
<div class="modal-footer">
<!--<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>-->
No
Yes
</div>
</div>
</div>
</div>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</body>
</html>
I have Question about component art grid.
Have anyone struggled with the selecting of a single row where your attribite is AllowMultipleSelect="false" but you are still able to select Multiple rows.
I just can't seem to get around this because I only want the selected row highlighted with what ever color the selectedRowCssClass color is.
Here is my front end code:
<%# Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<base target="_self" />
<title>iView Trend Data</title>
<link href="Assets/OldCss/gridStyle.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<asp:HiddenField ID="ParamA" runat="server" />
<asp:HiddenField ID="ParamB" runat="server" />
<table style="width:100%; Height:100%;" >
<tr>
<td>
<ComponentArt:CallBack id="CallBack1" CacheContent="false" width="100%" Height="100%" runat="server">
<Content>
<ComponentArt:Grid ID="Grid1"
CssClass="Grid"
runat="server"
RunningMode="Client"
ShowFooter="false"
ImagesBaseUrl="~/Assets/Image/Grid/"
Sort="DateTime"
ScrollBar="Auto"
ScrollTopBottomImagesEnabled="true"
ScrollTopBottomImageHeight="2"
ScrollTopBottomImageWidth="16"
ScrollImagesFolderUrl="~/Assets/Image/Grid/"
ScrollButtonWidth="16"
ScrollButtonHeight="17"
ScrollBarCssClass="ScrollBar"
ScrollGripCssClass="ScrollGrip"
ScrollBarWidth="16"
ScrollPopupClientTemplateId="ScrollPopupTemplate"
Width="760"
Height="618"
AllowTextSelection="false"
AllowHorizontalScrolling="True"
AllowMultipleSelect="false"
PageSize="30"
ShowHeader="true"
ShowSearchBox="true"
SearchOnKeyPress="true"
Visible="true"
AllowVerticalScrolling="False"
GroupingNotificationText="">
<Levels>
<ComponentArt:GridLevel
DataKeyField="DateTime"
ShowTableHeading="False"
ShowSelectorCells="False"
HeadingCellCssClass="HeadingCell"
HeadingCellHoverCssClass="HeadingCellHover"
HeadingCellActiveCssClass="HeadingCellActive"
HeadingTextCssClass="HeadingCellText"
DataCellCssClass="DataCell"
RowCssClass="DataRow"
SelectedRowCssClass="SelectedRow"
SortAscendingImageUrl="asc.gif"
SortDescendingImageUrl="desc.gif"
ColumnReorderIndicatorImageUrl="reorder.gif"
SortedDataCellCssClass="SortedDataCell"
SortImageWidth="14"
SortImageHeight="14"
AllowGrouping="false"
AlternatingRowCssClass="AlternatingRow">
<Columns>
<ComponentArt:GridColumn DataField="DateTime" Width="100" FormatString="yyyy-MM-dd HH:mm" Visible="false"/>
</Columns>
</ComponentArt:GridLevel>
</Levels>
<clienttemplates>
<ComponentArt:ClientTemplate Id="ScrollPopupTemplate">
<table cellspacing="0" cellpadding="2"
border="0" class="ScrollPopup">
<tr>
<td style="width:50px;">
<div style="font-size:10px;font-family:MS Sans Serif; text-overflow:ellipsis; overflow:visible;">
<nobr>## DataItem.GetMember("DateTime").Text ##</nobr>
</div>
</td>
</tr>
</table>
</ComponentArt:ClientTemplate>
</clienttemplates>
</ComponentArt:Grid>
</Content>
<LoadingPanelClientTemplate>
<table width="100%" align="center" style="position:relative;top:250px">
<tr>
<td style="color:#cee820" align="right">Loading..</td>
<td align="left"> <img src="./images/ajax-loader.gif" width="48" height="48" border="0"/></td>
</tr>
</table>
</LoadingPanelClientTemplate>
</ComponentArt:CallBack>
</td>
</tr>
</table>
</form>
</body>
</html>
I had a similar problem, which turned out to be because values of the DataKeyField had spaces in them.
I have a static form whose code is bellow. Basically I would like to style it with Twitter-bootstrap. Thus I was wondering how to implement it under Xampp. I have placed the bootstrap folder under Xammp/htdocs/MyLocalHostWebsiteFolderName/bootstrap, added a class to the form HTML code but bootstrap was not compiled with the form.
cAN YOU HELP ME BREATH SOME LIFE IN THAT BEATEN UP CODE?
<html>
<head>
<title>Limited Sampling Strategies for AUC estimation</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".msg_body").hide();
$(".msg_head").click(function(){
$(this).next(".msg_body").slideToggle(600);
});
});
</script>
</head>
<body>
<center>
<form action="form.php" class="form-horizontal" target="results" enctype="multipart/form-data" method='post'>
<h1>Limited Sampling Strategies for AUC estimation</h1>
<table border=0>
<tr valign="top">
<td>
<table border=1>
<caption>Data</caption>
<tr>
<th>Concentrations</th>
<td> <input type="file" name="concentrations" size="20"></td>
</tr>
<tr>
<th>Times</th>
<td> <input type="file" name="times" size="20"></td>
</tr>
<tr>
<th>Covariates</th>
<td> <input type="file" name="covariates" size="20"></td>
</tr>
</table>
<br>
</td>
</table>
</form>
</center>
</body>
</html>
Solved my problem. The form code should call bootstrap library before the HTML code otherwise the CSS classes are not recognized. Putting your form HTML code in the bootstrap folder alone is not enough. The structure goes like this
<!DOCTYPE html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<center>
<form class="form-inline" action="form.php" target="results" enctype="multipart/form-data" method='post'>
</form>
</center>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
I was wondering how I can get an echo of the duration of a test.
I already got the time stamp at the beginning of the test and at the end, but for the reason of laziness it would be nice to get an echo displaying the time it took to run the test.
Here is the code that works on my side. It displays 5 sec duration (pause in test). Try it yourself:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.google.com.ua/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
<td>storeEval</td>
<td>{new Date()}</td>
<td>Cur_time</td>
</tr>
<tr>
<td>echo</td>
<td>${Cur_time}</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>{new Date()}</td>
<td>Cur_time2</td>
</tr>
<tr>
<td>echo</td>
<td>${Cur_time2}</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>{(storedVars["Cur_time2"].getTime() - storedVars["Cur_time"].getTime())/1000}</td>
<td>diff</td>
</tr>
<tr>
<td>echo</td>
<td>${diff}</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
storeEval is your friend here.
I'm assuming you have the start and end timestamps stored in variables, so you can storeEval end-start and echo the result
I am new to struts 2. I am facing problem in filling Select tag with list property. The values are supplied from action class.Please provide me sample sode for this scenario.
My action class
public class TripDetailsAdd extends ActionSupport {
#Override
public String execute() throws Exception {
return SUCCESS;
}
public String populate() {
VehicleDAO vehicleDAO = new VehicleDAO();
this.lstVehicles.addAll(vehicleDAO.getAllVehicles());
return "populate";
}
private String vehicleId;
private Collection lstVehicles = new ArrayList<VehiclesVO>();
}
Jsp page content:
<%# taglib prefix="s" uri="/struts-tags"%>
<%# taglib prefix="sform" uri="/struts-dojo-tags"%>
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%#page import="com.vms.business.dao.VehicleDAO"%>
<%#page import="java.util.Collection"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Trip Details</title>
</head>
<body>
<s:form action="tripDetailsAdd" method="POST" >
<s:hidden name="expenseTypeId"></s:hidden>
<table width="100%" height="96%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><!-- Menu Starts --> <jsp:include
page="/pages/menu.jsp"></jsp:include> <!-- Menu End -->
<table width="95%" align="center">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="highlight">Trip Details Add</td>
<td><s:actionerror /><s:actionmessage /></td>
</tr>
<tr>
<td class="header3shadow" colspan="2"><img height="2"
border="0" width="100%"></img></td>
</tr>
</table>
<table>
<tr>
<td> </td>
</tr>
</table>
<div
style="overflow: auto; height: expression((document.body.clientHeight -80) +px ');">
<table width="60%" cellspacing="0" cellpadding="0" border='0'>
<tr>
<td class="FieldTitle" valign="top">
<table width="100%" cellspacing="4" cellpadding="0" border='0'>
<s:select headerKey="0" headerValue="Select One" required="*" label="Vehicle No."
labelSeparator=":" list="lstVehicles" listKey="vehicleId" listValue="regNo"></s:select>
</td>
</tr>
<tr>
<td>
<table width="100%" cellspacing="4" cellpadding="0" border='0'>
<s:textfield labelposition="left" requiredposition="right"
name="totalIncome" label="Total Income" cssStyle="FieldTitle"
labelSeparator=":"></s:textfield>
</table>
</td>
</tr>
</table>
<table cellpadding="0" width="60%" cellspacing="0" border="0">
<tr>
<td align="right"><s:submit label="Add" value="Add"></s:submit></td>
</tr>
</table>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</s:form>
</body>
</html>
Mapping
<action name="*TripDetailsAdd" method="{1}"
class="com.vms.trip.presentation.TripDetailsAdd">
<result name="success" type="redirect">showTripDetailsList
</result>
<result name="populate">/pages/tripdetails/TripDetailsAdd.jsp
</result>
<result name="error">/pages/tripdetails/TripDetailsAdd.jsp
</result>
<result name="input">/pages/tripdetails/TripDetailsAdd.jsp
</result>
</action>
In this if i add Validation file or If any error occurs in page drop down is not loading.Please help me..
Struts2 select tag
<s:select label="Pets"
name="petIds"
list="petDao.pets"
listKey="id"
listValue="name"
value="%{petDao.pets.{id}}"
/>
In the above. value = default selection, list = collection (of Map) coming from your action class, listKey = Key for map, listValue = value for map.
Edit (after looking at provided code):
your problem is that you do not have any getter in action class that corresponds with lstVehicles (which is mentioned in list property of your select tag)
Add this to your action class:
public List getLstVehicles ()
{
return this.lstVehicles;
}