homepage Welcome to WebmasterWorld Guest from 50.17.7.84
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
getting the info of the previous POSTs
web_server




msg:1278114
 10:46 am on Apr 20, 2006 (gmt 0)

Hi ,
I'll list the code first then explian my problem . it is about dragging and dropping images :
//----------------------------------------------------
//----------------------------------------------------
//----------------------------------------------------//----------------------------------------------------<HTML ><HEAD>
<TITLE>Drag&Drop</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">

<!-- Hide script from older browsers
function subform()
{
document.myform.text.value=document.myform.NAME.value;
document.myform.submit()
}

// End hiding script -->
</SCRIPT>

<META http-equiv=content-type content="text/html; charset=iso-8859-1">
<META http-equiv=imagetoolbar content=no><LINK href="Drag&amp;Drop_files/newwalterzorn.css" type=text/css rel=stylesheet>

<STYLE type=text/css>
BODY
{
PADDING-RIGHT: 40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 40px; PADDING-TOP: 40px
}
</STYLE>
</HEAD>

<BODY bgColor="#ffffff">
<?
if(trim($NAME=="image1"))
{
$f=1;
if(($X=475)&&($Y==263)){$a="l";}
else if(($X==2)&&($Y==2)){$a="r";}
else{$a=p;}
}
if(trim($NAME=="image2"))
{ if(($X=475)&&($Y==263)){$a="l";}
else if(($X==2)&&($Y==2)){$a="r";}
else{$a=p;}
$f=2;}
?>
<SCRIPT src="Drag&amp;Drop_files/wz_dragdrop.js" type=text/javascript></SCRIPT>
<BR>

<center>
<table border="0" width="739" id="table1">

<tr>
<td width="104" height="95"><?if(($f!=1)&&($m1!=1)){?>
<img border="0" src="1.gif" width="104" height="95" name=image1><?}
else if(($f==1)&&($m1!=1)&&($a=="p")){?>
<img border="0" src="1.gif" width="104" height="95" name=image1><?}
?></td>
<td width="104" height="95"><?if(($f!=2)&&($m2!=1)){?>
<img border="0" src="2.gif" width="104" height="95" name=image2><?}
else if(($f==2)&&($m2!=1)&&($a=="p")){?>
<img border="0" src="2.gif" width="104" height="95" name=image2><?}
?></td>
<table border="0" width="100%" id="table2" height="100%" background="10.gif" cellspacing="0" cellpadding="0">

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="90" height="60" >
<?
if(($a=="r")&&($p5==1)&&($p6!=1))
{
$p6=1;
if($f==1){$index6=1;$m1=1;}
if($f==2){$index6=2;$m2=1;}
}
if($p6==1){?><img border="0" src="<?=$index6?>" width="90" height="70"><?}
?>

</td>
<td>&nbsp;</td>
<td width="90" height="60">
<?
if(($a=="l")&&($p2==1)&&($p3!=1))
{
$p3=1;
if($f==1){$index3=1;$m1=1;}
if($f==2){$index3=2;$m2=1;}
}
if($p3==1){?><img border="0" src="<?=$index3?>" width="90" height="70"><?}
?>

</td>
</tr>
<tr>
<td width="90" height="60">
<?
if(($a=="r")&&($p5!=1)&&($p4==1))
{
$p5=1;
if($f==1){$index5=1;$m1=1;}
if($f==2){$index5=2;$m2=1;}
}
if($p5==1){?><img border="0" src="<?=$index5?>" width="90" height="70"><?}
?>

</td>
<td>&nbsp;</td>
<td width="90" height="60">

<?
if(($a=="l")&&($p2!=1)&&($p1==1))
{
$p2=1;
if($f==1){$index2=1;$m1=1;}
if($f==2){$index2=2;$m2=1;}
}
if($p2==1){?><img border="0" src="<?=$index2?>" width="90" height="70"><?}
?>

</td>
</tr>
<tr>
<td width="90" height="60">
<?
if(($a=="r")&&($p4!=1))
{echo"4";
$p4=1;
if($f==1){$index4=1;$m1=1;}
if($f==2){$index4=2;$m2=1;}
}
if($p4==1){?><img border="0" src="<?=$index4?>" width="90" height="70" ><?}
?>

</td>
<td>&nbsp;</td>
<td width="90" height="60">
<?
if(($a=="l")&&($p1!=1))
{
$p1=1;
if($f==1){$index1=1;$m1=1;}
if($f==2){$index1=2;$m2=1;}
}
if($p1==1){?><img border="0" src="<?=$index1?>" width="90" height="70" ><?}
print ("ll".$_GET['i']);
if (isset ($_POST))
{
//print ($_POST['NAME']);
print($_POST['text']);
$i++;
print ($i);

}
?>

&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</td>
</tr>
<tr>
<td width="104" height="95"><?if(($f!=4)&&($m4!=1)){?>
<img border="0" src="4.gif" width="104" height="95" name=image4><?}
else if(($f==4)&&($m4!=1)&&($a=="p")){?>
<img border="0" src="4.gif" width="104" height="95" name=image4><?}
?></td>
<td width="104" height="95"><?if(($f!=5)&&($m5!=1)){?>
<img border="0" src="5.gif" width="104" height="95" name=image5><?}
else if(($f==5)&&($m5!=1)&&($a=="p")){?>
<img border="0" src="5.gif" width="104" height="95" name=image5><?}
?></td>
<td width="104" height="95"><?if(($f!=6)&&($m6!=1)){?>
<img border="0" src="6.gif" width="104" height="95" name=image6><?}
else if(($f==6)&&($m6!=1)&&($a=="p")){?>
<img border="0" src="6.gif" width="104" height="95" name=image6><?}
?></td>
</tr>
</table></center>

<!--<form method="POST" action="test.php">-->
<FORM name="myform" method="POST" action="page2.php">
<INPUT type="hidden" size=12 name="m1" value="<?=$m1?>">
<INPUT type="hidden" size=12 name="m2" value="<?=$m2?>">
<INPUT type="hidden" size=12 name="p1" value="<?=$p1?>">
<INPUT type="hidden" size=12 name="p2" value="<?=$p2?>">
<INPUT type="hidden" size=12 name="index1" value="<?=$index1?>">
<INPUT type="hidden" size=12 name="index2" value="<?=$index2?>">
<INPUT type="hidden" size=12 name=NAME>
<INPUT type="hidden" size=12 name=X>
<INPUT type="hidden" size=12 name=Y>
<textarea name=text /> </textarea>

</form>
<!--<input type="submit" />-->
<!--</form>-->

<SCRIPT type=text/javascript>
<!--

SET_DHTML(CURSOR_MOVE, TRANSPARENT, "image1", "image2", "image3", "image4", "image5","image6");

// The following loop creates a copy for each of the two images,
// but hides that copy immediately while the page is still loading
for (var i = 0; i < 9; i++)
{
dd.elements[i].copy();
dd.elements[i].copies[0].hide();
}

// The following two functions override their empty namesakes predefined in wz_dragdrop.js.
// They are automatically invoked from wz_dragdrop.js when a drag operation starts
// and ends, respectively.

// Here we make the non-transparent 'placeholder' copy of the dragged image visible
// and move it to the place where the drag operation starts
function my_PickFunc()
{
dd.obj.copies[0].moveTo(dd.obj.x, dd.obj.y);
dd.obj.copies[0].show();
}

// Here we hide the 'placeholder' again
function my_DropFunc()
{
dd.obj.copies[0].hide();

if (dd.obj.name == 'image1') {
document.myform.NAME.value = dd.obj.name;

if((dd.obj.x>=450)&&(dd.obj.x<=663)&&(dd.obj.y>=57)&&(dd.obj.y<=420))

{
document.myform.X.value =475;
document.myform.Y.value =263;
subform();

}
else if((dd.obj.x>=663)&&(dd.obj.x<=877)&&(dd.obj.y>=57)&&(dd.obj.y<=420))
{
document.myform.X.value =742;
document.myform.Y.value =297;
subform();

}
else
{
document.myform.X.value =124;
document.myform.Y.value =68;
subform();

}
}
//***************************************

if (dd.obj.name == 'image2') {
document.myform.NAME.value = dd.obj.name;
if((dd.obj.x>=450)&&(dd.obj.x<=663)&&(dd.obj.y>=57)&&(dd.obj.y<=420))

{
document.myform.X.value =475;
document.myform.Y.value =263;
subform();

}
else if((dd.obj.x>=663)&&(dd.obj.x<=877)&&(dd.obj.y>=57)&&(dd.obj.y<=420))
{
document.myform.X.value =742;
document.myform.Y.value =297;
subform();

}
else
{
document.myform.X.value =234;
document.myform.Y.value =68;
subform();

}
}
//***************************************

// Write the name and coordinates of the dropped item into form inputs:
document.myform.NAME.value = dd.obj.name;
document.myform.X.value = dd.obj.x;
document.myform.Y.value = dd.obj.y;
}
//-->
</SCRIPT>
</BODY></HTML>
//----------------------------------------------------
//----------------------------------------------------
//----------------------------------------------------//----------------------------------------------------
now I want to know all the images the user draged it before I can go to any other page . for knowing which picture the user dragded I put a textarea feild that displys the name of the image in it.
the problem is each new drag will make a new post and therefore I lose all the info. from any previous POSTs.
I hope that I explained my problem clearly.
thank you.

 

Finger




msg:1278115
 8:22 pm on Apr 20, 2006 (gmt 0)

I didn't read all of your code but my suggestion to your question would be to use mysql or some db to make records of each post, and then you'll have the post history available. Hope this helps.

marcmesa




msg:1278116
 12:09 am on Apr 21, 2006 (gmt 0)

I don't read all the code but...
I think you can use a database to hold the values or use session variables to store it.
Maybe you don't need to send the form every time an image is dragged. You could use a function to append the name of the images to the textarea or a hidden field, or use a javascript array (then asign its value to the text area like "whatever.mytextarea.value=images[]").

If you append the images name to the text area or a hidden field separate the values with some character (,), so when you post the values you can use explode in php

hope it helps

hakre




msg:1278117
 9:20 am on Apr 21, 2006 (gmt 0)

now I want to know all the images the user draged it before I can go to any other page . for knowing which picture the user dragded I put a textarea feild that displys the name of the image in it.
the problem is each new drag will make a new post and therefore I lose all the info. from any previous POSTs.
I hope that I explained my problem clearly.
thank you.

first of all your error is by design. i did not read your code i just read your own problems description quoted above, because your problem is not code related and you should study the forums rules first not to run into any problems: just post the related code! no one will even read that, anyway.

when each drag-drop creates a form submission (new post) just ensure all other data is passed within that operation. you can use hidden form fields for that (<input type="hidden" [...] />).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved