hi ...
welcome to TSDN ...
please post some code concerning your problem ... show how you add the event-handlers ...
kind regards
Hi,
i am sending my code can u help me
<?php
include('db_config.php');
/*mysql_connect('localhost', 'root','');
mysql_select_db('wakapa_db');
error_reporting(E_ALL^E_WARNING^E_NOTICE);
*/
$_REQUEST['uid'] = 1;
function parse_data($data){
$containers = explode(":", $data);
foreach($containers AS $container)
{
$container = str_replace(")", "", $container);
$i = 0;
$lastly = explode("(", $container);
$values = explode(",", $lastly[1]);
foreach($values AS $value)
{
if($value == '')
{
continue;
}
$final[$lastly[0]][] = $value;
$i ++;
}
}
return $final;
}
function update_db($data_array, $col_check){
foreach($data_array AS $set => $items)
{
$i = 0;
foreach($items AS $item)
{
$item = mysql_escape_string($item);
$set = mysql_escape_string($set);
$value=$value.$item.",";
$i ++;
}
}
$storyarr=explode(",",$value);
for($i=0;$i<count($storyarr)-1;$i++){
$txtbox = "txtlist".$storyarr[$i];
$urltxtbox = "txturllist".$storyarr[$i];
$order_id = ($i+1);
$selectval="select * from todays_news where uid=".$_REQUEST['uid'];
$resultval=mysql_query($selectval);
$valueresult=mysql_num_rows($resultval);
if($valueresult>0){
$updatestory="update todays_news set label='".$_POST[$txtbox]."',url='".$_POST[$urltxtbox]."' where uid=".$_REQUEST['uid']." and order_id=".$order_id;
mysql_query($updatestory);
}
else{
for($i=1;$i<=8;$i++){
echo $insertq = "insert into todays_news(order_id,uid,label,url) values(".$i.",".$_REQUEST['uid'].",'".$_POST[$txtbox]."','".$_POST[$urltxtbox]."')";
mysql_query($insertq);
}
}
}
}
// Lets setup Sajax
require_once('dd/Sajax.php');
sajax_init();
// $sajax_debug_mode = 1;
function sajax_update($data){
$data = parse_data($data);
update_db($data, "AND (`set` = 'sajax1' OR `set` = 'sajax2')");
return 'y';
}
sajax_export("sajax_update");
sajax_handle_client_request();
if(isset($_POST['order']))
{
$data = parse_data($_POST['order']);
update_db($data, "AND (`set` = 'left_col' OR `set` = 'right_col' OR `set` = 'center')");
// redirect so refresh doesnt reset order to last save
}
?>
<html>
<head>
<title>Drag Drop</title>
<style type="text/css">
#left_col {
width: 180px;
float: left;
margin-left: 5px;
}
#center {
width: 180px;
float: left;
margin-left: 5px;
}
#right_col {
width: 180px;
float: left;
margin-left: 5px;
}
#sajax1 {
width: 180px;
float: left;
margin-left: 5px;
}
#sajax2 {
width: 180px;
float: left;
margin-left: 5px;
}
form {
clear: left;
}
h2 {
color: #7DA721;
font-weight: normal;
font-size: 14px;
margin: 20px 0 0 0;
}
br {
clear: left;
}
.form-text{
width: 8em;
height: 1.9em;
padding: 0 0.2em 0 0.2em;
margin: 0 0 0.5em 0;
border: 1px solid #744533;
}
input.button
{
color:#FFFFFF;
font-size:9.0pt;
font-weight:bold;
border:0.8pt
border-color:#FF3333;
color:#000000;
height:18.0pt;
width:66.0pt;
font-family:Verdana;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#cccccc',EndColorSt r='#FFFFFF');
}
</style>
<link rel="stylesheet" href="dd/dd_files/lists.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="dd/dd_files/coordinates.js"></script>
<script language="JavaScript" type="text/javascript" src="dd/dd_files/drag.js"></script>
<script language="JavaScript" type="text/javascript" src="dd/dd_files/dragdrop.js"></script>
<script type="text/javascript" src="dd/dd_files/ajaxObj.js"></script>
<script language="JavaScript" type="text/javascript"><!--
<?php sajax_show_javascript(); ?>
function confirm(z){
window.status = 'Sajax version updated';
}
function onDrop() {
var data = DragDrop.serData('g2');
x_sajax_update(data, confirm);
}
window.onload = function() {
var list = document.getElementById("center");
DragDrop.makeListContainer( list, 'g1' );
list.onDragOver = function() { this.style['background'] = "#EEF"; };
list.onDragOut = function() {this.style['background'] = "none"; };
};
function getSort(){
alert("rama");
var order = document.getElementById("order");
alert(order);
order.value = DragDrop.serData('g1', null);
alert(order.value);
//showValue();
}
function showValue(){
order = document.getElementById("order");
}
function updatenull(id){
document.getElementById("txt"+id).value='';
//story=document.getElementById(
story='';
getSort();
document.draggg.action="dd.php?vid="+encodeURI(id) +"&storypost="+encodeURI(story);
document.draggg.submit();
}
function deleteBox(id){
document.getElementById(id).value = '';
getSort();
document.draggg.submit();
}
function load() {
document.forms[0].txtlist8.focus();
}
/*function init()
{
document.getElementById('txtlist1').focus()";
}*/
//-->
</script>
</head>
<body onload="load();">
<form action="" name="draggg" id="draggg" method="post">
<table width=95% cellpadding=0 cellspacing="0" border="0" align="center" style="cursor:pointer;"><tr><td>Today's News:</td><td> </td></tr><tr><td> </td><td> </td></tr><tr><td width="50%">Label:</td><td>URL</td></tr></table>
<table cellpadding=0 cellspacing="0" border="0" width="690px">
<tr>
<td width="690px">
<ul name="center" id="center" class="sortable boxy" style="width:690px">
<?
$j=1;
$r = mysql_query("select * from todays_news where uid=".$_REQUEST['uid']);
while($rw = mysql_fetch_array($r)){
if($rw['label']!=""){
echo '<li name="list'.$j.'" id="list'.$j.'" value="'.$j.'" style="width:690px"><div name="list'.$j.'" id="list'.$j.'" value="'.$j.'"><table border="0" cellpadding=0 cellspacing="0" width=100%><tr><td><input type="text" class="form-text" style="width:24em;" value="'.$rw['label'].'" name="txtlist'.$j.'" id="txtlist'.$j.'"></td><td width="10"> </td><td><strong><a href="#"><span><input type="text" class="form-text" style="width:24em;" value="'.$rw['url'].'" id="txturllist'.$j.'" name="txturllist'.$j.'"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$j.'\');">X</a></td></tr></table></div></li>';
$j++;
}
}
for($k=$j;$k<=8;$k++){
echo '<li name="list'.$k.'" id="list'.$k.'" value="'.$k.'" style="width:690px"><div name="list'.$k.'" id="list'.$k.'" value="'.$k.'"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><input type="text" name="txtlist'.$k.'" id="txtlist'.$k.'" value="" class="form-text" style="width:24em;"></td><td width="10"> </td><td><strong><a href="#"><span><input type="text" name="txturllist'.$k.'" id="txturllist'.$k.'" value="" class="form-text" style="width:24em;"></span></a></strong></td><td><a href="#" onclick="deleteBox(\'list'.$k.'\');">X</a></td></tr></table></div></li>';
}
?>
</ul>
</td>
</tr>
</table>
<br/>
<input type="hidden" name="order" id="order" value="" />
<input type="hidden" name="uid" id="uid" value="<?echo $_REQUEST['uid'];?>" />
<input type="submit" class="form-submit" onclick="getSort()" value="Update Order" />
</form>
</body>
</html>