473,395 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Post variables after java sort are lost

Hello,

I have an HTML table that is being constructed from a MySQL table and
displays a form that includes a check box on 1 of the fields on the form for
each record. I have included in this PHP program a javascript routine called
sorttable.js which is something I found on the internet for sorting tables
and works quite well. The HTML table includes a check box on each record so
the user can select certain records for passing to the next process. This
works fine unless I sort the table on some column and then the POST
variables are lost. When I run the following code there are no POST
variables that will echo except the submit button.

foreach ($_POST as $varName =$value){
echo ($varName . " = " . $value);
}

However, if I don't sort the table the POST variables will be echoed for
every record in the table. I'm not sure why this is happening or how to go
about solving it. When I check certain records on the form and then sort the
table the checks themself don't disappear only the POST variables do. This
prevents me from looping thru the ARRAY to determine the value of the POST
check box for each record to see if it was checked. If I run the above code
but don't sort it I will have several hundred POST variables (several for
each record).

Could someone give me an idea on how to solve this or offer some sort of
work-around??

Thanks Very Much!

Vic
Mar 15 '07 #1
3 2048
Vic Spainhower wrote:
Hello,

I have an HTML table that is being constructed from a MySQL table and
displays a form that includes a check box on 1 of the fields on the form for
each record. I have included in this PHP program a javascript routine called
sorttable.js which is something I found on the internet for sorting tables
and works quite well. The HTML table includes a check box on each record so
the user can select certain records for passing to the next process. This
works fine unless I sort the table on some column and then the POST
variables are lost. When I run the following code there are no POST
variables that will echo except the submit button.

foreach ($_POST as $varName =$value){
echo ($varName . " = " . $value);
}

However, if I don't sort the table the POST variables will be echoed for
every record in the table. I'm not sure why this is happening or how to go
about solving it. When I check certain records on the form and then sort the
table the checks themself don't disappear only the POST variables do. This
prevents me from looping thru the ARRAY to determine the value of the POST
check box for each record to see if it was checked. If I run the above code
but don't sort it I will have several hundred POST variables (several for
each record).

Could someone give me an idea on how to solve this or offer some sort of
work-around??

Thanks Very Much!

Vic

Maybe fix your javascript code? This isn't a PHP problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 15 '07 #2
>Maybe fix your javascript code? This isn't a PHP problem.

I know it's not a PHP problem and I don't know javascript or I would fix it.
I was hoping someone could offer a work-around as how to sort tables with
PHP on the fly.

Vic
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:4d******************************@comcast.com. ..
Vic Spainhower wrote:
>Hello,

I have an HTML table that is being constructed from a MySQL table and
displays a form that includes a check box on 1 of the fields on the form
for each record. I have included in this PHP program a javascript routine
called sorttable.js which is something I found on the internet for
sorting tables and works quite well. The HTML table includes a check box
on each record so the user can select certain records for passing to the
next process. This works fine unless I sort the table on some column and
then the POST variables are lost. When I run the following code there are
no POST variables that will echo except the submit button.

foreach ($_POST as $varName =$value){
echo ($varName . " = " . $value);
}

However, if I don't sort the table the POST variables will be echoed for
every record in the table. I'm not sure why this is happening or how to
go about solving it. When I check certain records on the form and then
sort the table the checks themself don't disappear only the POST
variables do. This prevents me from looping thru the ARRAY to determine
the value of the POST check box for each record to see if it was checked.
If I run the above code but don't sort it I will have several hundred
POST variables (several for each record).

Could someone give me an idea on how to solve this or offer some sort of
work-around??

Thanks Very Much!

Vic


Maybe fix your javascript code? This isn't a PHP problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 15 '07 #3
Vic Spainhower wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:4d******************************@comcast.com. ..
>Vic Spainhower wrote:
>>Hello,

I have an HTML table that is being constructed from a MySQL table and
displays a form that includes a check box on 1 of the fields on the form
for each record. I have included in this PHP program a javascript routine
called sorttable.js which is something I found on the internet for
sorting tables and works quite well. The HTML table includes a check box
on each record so the user can select certain records for passing to the
next process. This works fine unless I sort the table on some column and
then the POST variables are lost. When I run the following code there are
no POST variables that will echo except the submit button.

foreach ($_POST as $varName =$value){
echo ($varName . " = " . $value);
}

However, if I don't sort the table the POST variables will be echoed for
every record in the table. I'm not sure why this is happening or how to
go about solving it. When I check certain records on the form and then
sort the table the checks themself don't disappear only the POST
variables do. This prevents me from looping thru the ARRAY to determine
the value of the POST check box for each record to see if it was checked.
If I run the above code but don't sort it I will have several hundred
POST variables (several for each record).

Could someone give me an idea on how to solve this or offer some sort of
work-around??

Thanks Very Much!

Vic

Maybe fix your javascript code? This isn't a PHP problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

>>Maybe fix your javascript code? This isn't a PHP problem.

I know it's not a PHP problem and I don't know javascript or I would
fix it.
I was hoping someone could offer a work-around as how to sort tables
with
PHP on the fly.

Vic

(Top posting fixed)

PHP is server-side. It can't sort client-side. To sort with PHP you
would have to call the server, get the data again (this time sorted) and
redisplay the page. Not hard, but some extra overhead compared to the
Javascript.

P.S. Please don't top post.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
2
by: CCP | last post by:
I've got a simple HTML page containing a form and a few hidden variables. This form post into a .Net application (that lives in a seperate directory). The first thing I do in my codebehind is...
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
12
by: Assaf | last post by:
Hi all, My client is using an online service provider that processes survey responses. After a user fills survey.aspx and presses the OK button, 2 things need to happen: 1. the data has to...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
7
by: Erik | last post by:
I have an application that uses sessions variables a lot but one I publish the application on the prod server these variables are lost. The application is written i c# 2.0 and I've set the...
10
by: Nils Erik Dall | last post by:
Hi All I have a problem with my asp code on an iis 6.0 server on windows 2003 web. When I redirect between to asp pages on my web-site, where pageA is in a different virtual directory from pageB...
5
Atli
by: Atli | last post by:
Hi everybody. After years of C# and PHP, I'm finally returning to Java. My goal is to create a Java program capable of sending images to a PHP Photo Album on my web server. Right now, however,...
41
by: none | last post by:
Hello, IIRC, I once saw an explanation how Python doesn't have "variables" in the sense that, say, C does, and instead has bindings from names to objects. Does anyone have a link? Thanks, ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.