473,397 Members | 2,099 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,397 software developers and data experts.

POST and HTML Forms

Hi,

I am currently designing an HTML page with a form with a post method.
The page is calling itself so with the details that are passed will
vary how the page will look i.e. number of results from the sql query
that is being run. I'm trying to catch these using a javascript
function which is:

var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
document.writeln(query);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}

and then just calling the array to get the value, in this case
qsParm['num_res']. The above function doesnt work for post but does for
get. I'm fairly new to javascript and am assuming this line is at
fault:
var query = window.location.search.substring(1);
but I'm not sure what it should be.

Any help will be much appreciated.

Thanks

Simon

Nov 2 '05 #1
3 1377

accyboy1981 wrote:
Hi,

I am currently designing an HTML page with a form with a post method.
The page is calling itself so with the details that are passed will
vary how the page will look i.e. number of results from the sql query
that is being run. I'm trying to catch these using a javascript
function which is:

var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
document.writeln(query);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}

and then just calling the array to get the value, in this case
qsParm['num_res']. The above function doesnt work for post but does for
get. I'm fairly new to javascript and am assuming this line is at
fault:
var query = window.location.search.substring(1);
but I'm not sure what it should be.

Any help will be much appreciated.

Thanks

Simon


Yes you are correct. When you submit a form through "post", those
values can only be parsed with a server-side script, e.g. (asp, php,
jsp), while a client-side script (in this case, javascript), can only
parse those values when you submit a form through "get".

Nov 2 '05 #2
On Wed, 02 Nov 2005 09:31:06 -0800, web.dev wrote:
I am currently designing an HTML page with a form with a post method.
The page is calling itself so with the details that are passed will vary
how the page will look i.e. number of results from the sql query that is
being run. I'm trying to catch these using a javascript function which
is:

var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);


Walk the submitted forms elements instead.

Sincerely,
Joachim

Nov 2 '05 #3

Sorry, this was misquoted, the OP was "accyboy1981" <ac*********@gmail.com>.
Nov 2 '05 #4

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

Similar topics

5
by: Ralph Freshour | last post by:
I'm trying to use an image as a submit button - I'm reading Sams Teach Yourself HTML and the chapter on this doesn't show me the details on how this is done - I mean I can't seem to see it or grasp...
4
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most...
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
18
by: q2005 | last post by:
Hi, all When I do as the following, it becomes a GET action to the the server. How do I make it as a POST action? That means I don't want the string after "?" show on URL bar and, to the...
0
by: Prescott | last post by:
I want to execute a javascript function that will set a value in the parent window from the child widow where its called and then post the form to the server. I seem to be able to execute one or...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
4
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears...
13
by: Thom Little | last post by:
I have an HTML Form that uses GET and is processed by an ASP.NET 1.1 web application. Can you recommend a simple example of an HTML Form that uses POST and is processed by an ASP.NET web...
6
by: salmobytes | last post by:
After a javascript-generated post event (this is a post, not ajax messaging) the current screen has to be redrawn. But on *long forms* (longer than a single screen) then the current screen...
3
by: Jag | last post by:
Hi I am facing a strange issue. I have 3 ASP pages in the default website 1. auth.aspx <html> <body>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.