473,551 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Store multiple selection from pagination info into single array

41 New Member
Hi

I was using a schroll bar to display multiple rows of dynamically created from database records.
The scrolling was not displaying the data properly so I have decided to use pagination.

The problem I am having is,
if I select one item on page #1 and another on page #5
only the last item selected on page #5 is stored in the array.

How can I store selections from multiple pages into one array?

Noite: I am using foreach loop to insert the selected record into a seperate table.



[php]
<?php

session_start() ;

include("..db_c onnect_in.php") ;
?>

<html>
<body>
<form action ="../process.php" method="post">
<php?

$mysqli = db_connect();
db_select($mysq li, $db_id);


/**----------------------------paging--------------------------------*/

//how many rows to show per page
$BottomRowsPerP age = 17;

//by default we show first page
$BottomPageNum = 1;
//get the current page number
if(isset($_GET['botpage']))
{
$BottomPageNum = $_GET['botpage'];
}
//counting the offset
$BottomOffset = ($BottomPageNum - 1) * $BottomRowsPerP age;


/*************** ** determine which and how to select data to display ***************/
$query = "SELECT c.code_id, c.code, c.description
FROM code c
WHERE c.fee_code = m.code
AND c.section_code = 'K'
ORDER BY c.fee_code";

$BottomPagingQu ery = "LIMIT $BottomOffset, $BottomRowsPerP age";
$result = mysqli_query($m ysqli,$query.$B ottomPagingQuer y); //or die('Error, bot query failed');




//search area display area layer and table
echo "<table width=\"99%\" border=\"0\">
<tr align=\"center\ " bgcolor=\"#FFFF FF\" height=\"\">
<td width=\"100%\" >
<div id=\"Layer2\" style=\"positio n:absolute; width:100%; height:550px; z-index:2; left: 12px; top: 305px;\">
<div id=\"pat-dash-scroll-box2\" style=\"overflo w: off; float: left; width: 100%; height: 540px; margin: 0px; \">\n";


//table begins
echo "<table width=\"99%\" height=\"332\" left =\"40\" align = \"\" border=\"0\" font face =\"arial\">\n ";


/**----------------------loop record to display----------------------**/

$num_service = mysqli_num_rows ($result);
for($i=0; $i < $num_service; $i++)
{
$row = mysqli_fetch_ar ray($result);

list($code_id, $fee1_code, $description) = $row;



//diaplay search results in rows
echo"<tr height=\"10\">
<td width=\"4%\" bgcolor=\"#fff8 dc\" align=\"center\ ">
<input type=\"checkbox \" name=\"fee1_cho ice[$i]\" value=\"$code_i d\"></td>
<td width=\"7%\" bgcolor=\"#fff8 dc\" ><span class=\"style20 \"><strong>$fee 1_code</strong></span></td>
<td width=\"3%\" bgcolor=\"$bgco lor\" height=\"10\">
<input type=\"text\" name=\"fee1_uni t[$i]\" size=\"1\" maxlength=\"2\" value =\"$fee1_unit \"/></td>
<td width=\"79%\" bgcolor=\"$bgco lor\" class=\"style20 \"> $description </td>
echo"</tr>\n";

}//end of for loop




/**----------------Bottom pagination-------------------**/
echo '<br>';
//how many rows we have in database
$result = mysqli_query($m ysqli,$query) or die('Error, 2 query failed');
$BottomNumRows = mysqli_num_rows ($result);

//how many pages we have when using paging?
$BottomMaxPage = ceil($BottomNum Rows/$BottomRowsPerP age);

$self = $_SERVER['PHP_SELF'];

/** creating 'previous' and 'next' link plus 'first page' and 'last page' link
print 'previous' link only if not on page one **/

if ($BottomPageNum > 1)
{
$BottomPage = $BottomPageNum - 1;
$BottomPrev = "<a href=\"$self?u_ find=$find&u_fi eld=$field&u_se arch=$searching &u_back=$back&u _special=$speci al&u_service=$s ervices&u_sch_y r=$schedule_yea r&toppage=$TopP ageNum&botpage= $BottomPage\">[Prev]</a> ";
$BottomFirst = "<a href=\"$self?u_ find=$find&u_fi eld=$field&u_se arch=$searching &u_back=$back&u _special=$speci al&u_service=$s ervices&u_sch_y r=$schedule_yea r&toppage=$TopP ageNum&botpage= 1\">[First Page]</a> ";
}
else
{
$BottomPrev = '[Prev]'; // we're on page one, don't enable 'previous' link ,
$BottomFirst = '[First Page]'; // nor 'first page' link
}

//print 'next' link only if we're not
//on the last page
if ($BottomPageNum < $BottomMaxPage)
{
$BottomPage = $BottomPageNum + 1;
$BottomNext = "<a href=\"$self?u_ find=$find&u_fi eld=$field&u_se arch=$searching &u_back=$back&u _special=$speci al&u_service=$s ervices&u_sch_y r=$schedule_yea r&toppage=$TopP ageNum&botpage= $BottomPage\">[Next]</a>";
$BottomLast = "<a href=\"$self?u_ find=$find&u_fi eld=$field&u_se arch=$searching &u_back=$back&u _special=$speci al&u_service=$s ervices&u_sch_y r=$schedule_yea r&botpage=$TopP ageNum&botpage= $BottomMaxPage\ ">[Last Page]</a>";
}
else
{
$BottomNext = '[Next]'; // we're on the last page, don't enable 'next' link
$BottomLast = '[Last Page]'; // nor 'last page' link
}

// print the page navigation link
echo"<center> ". $BottomFirst . $BottomPrev . " <strong>$Bottom PageNum</strong> of <strong>$Bottom MaxPage</strong> pages " . $BottomNext . $BottomLast."</center>";


echo"</div>\n";
echo "</div>\n";
echo "</table>\n";
echo "</table>\n";



$mysqli->close();//close connection to db

?>
</form>
</body>
</html>

[/php]
May 19 '07 #1
1 3365
pbmods
5,821 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1.   <td width=\"79%\" bgcolor=\"$bgcolor\" class=\"style20\"> $description </td>
  2.                        echo"</tr>\n";
You're missing a '"' character here; is this intentional? Also, you'll probably like string heredoc syntax.

As for your issue, I would imagine that if your Users' selections aren't getting saved, the problem would be in ../process.php instead.

Let's have a look at that file (try to post only the relevant areas, though. Thanks!).
May 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
12025
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location on the server (in our own accounts on the same machine). When I am testing both versions of our program using the same browser (IE on Windows or...
4
2661
by: Christopher Brandsdal | last post by:
Hi! I have a delicatg problem.... I have made a registration form for adding my friends information in a database. The problem is that I want to connect the persons with companies in the same database. I wonder how i could connect a person to several other id's in a table. I wonder if I can make a string in the database that holds all...
3
1991
by: Disco-181 | last post by:
Hi, I have a script which isn't working in Mozilla based browser for some reason. I'm trying to run two functions from the body onload tag and it simply isn't happening. I have a cascading menu, where the primary dropdown selection determines the contents of a second dropdown. This is triggered by a function in the onchange tag of the...
1
3061
by: jeffgeorge | last post by:
Trying to create multiple acct reports based on the selection in a list box. I've set the list box for multiple selections, and in the report data source, I have a SQL statement which is reading the list box(when there is a single selection) but no luck with multiple selections. I'm suspecting I need to write a bit of code using an array. ...
2
3110
by: Dolorous Edd | last post by:
Hi, for a program I'm working on I need to be able to drag multiple files between Windows Explorer and a ListBox, in both directions. Implementing the "drag in" was pretty easy, but I can't find a way to export more than on item at time. The ideal result would be to be able to drag the selected files, but as soon as I click on the LB to...
3
6480
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07162002.asp) but I don't want clients to have to add two web references and then manually have to edit the proxy classes....
7
6223
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the user and populated (with info from an Access database) at run-time, then saved as Word documents. The program I have coded works fine -- it does...
4
2987
by: serge | last post by:
I was working on figuring out where a certain application was storing the multiple selection choices I was doing through the app. I finally figured out that they were being store in an IMAGE data type colum with the variable length of 26 bytes. This is the first time I ran into such way of storing multiple selections in a single Image data...
4
2178
by: comp.lang.php | last post by:
'll try to explain this as clearly as possible, sorry if it's unclear. You have in your directory /foo 42 images You have in your database metadata for 30 out of those 42 images You have to display all 42 images in the /foo directory whether they have database metadata or not. If any of the 42 images have metadata, you must display...
0
7565
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7768
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5130
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3520
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
804
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.