473,320 Members | 1,839 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,320 software developers and data experts.

Post array values (beginner's question)

This might not be the right group for this question, since its kind of
a pure html question...

Given the html construct:

<form action='index.php?expand=0,10000' method='post'>
Email: <input type='text' name='login[email]' size='30'/>
Password:<input type='password' name='login[passwd]' size='30'/>
</form>

I'm trying to construct a url so that the form values are posted in the
url...

I.e, something like:
http://www.acme.com/index.php?expand0,10000&login[email]=j**@mail.com&login[passwd]=secret1234

.... but since the form values to receive the values looks like an
array(??) this doesn't seem to work.

Just wondering if anyone could give me some hints on what I'm doing
wrong here.

Thanks for any comments.

/Brian

Sep 28 '05 #1
6 10961
br*************@yahoo.com wrote:
This might not be the right group for this question, since its kind of
a pure html question...

Given the html construct:

<form action='index.php?expand=0,10000' method='post'>
Email: <input type='text' name='login[email]' size='30'/>
Password:<input type='password' name='login[passwd]' size='30'/>
</form>

I'm trying to construct a url so that the form values are posted in the
url...

I.e, something like:
http://www.acme.com/index.php?expand0,10000&login[email]=j**@mail.com&login[passwd]=secret1234

... but since the form values to receive the values looks like an
array(??) this doesn't seem to work.

Just wondering if anyone could give me some hints on what I'm doing
wrong here.

Thanks for any comments.

/Brian


For a post operation, the incoming data will be in the $_POST variable.

In your case you are using the id's "login[email]" and "login[passwd]',
so your values will be in the array as $_POST['login']['email'] and
$_POST['login]['passwd]

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 28 '05 #2
Hi and thanks for the tip. However, I'm having a bit of a puzzle trying
to figure out how one can post these variable via the url like:

http://www.acme.com/page.php?user=joe&passwd=secret1234

Any ideas?
Jerry Stuckle wrote:
For a post operation, the incoming data will be in the $_POST variable.

In your case you are using the id's "login[email]" and "login[passwd]',
so your values will be in the array as $_POST['login']['email'] and
$_POST['login]['passwd]

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


Sep 28 '05 #3

br*************@yahoo.com wrote:
Hi and thanks for the tip. However, I'm having a bit of a puzzle trying
to figure out how one can post these variable via the url like:

http://www.acme.com/page.php?user=joe&passwd=secret1234

Any ideas?


use GET instead opf POST

micha

Sep 28 '05 #4
br*************@yahoo.com wrote:
Hi and thanks for the tip. However, I'm having a bit of a puzzle trying
to figure out how one can post these variable via the url like:

http://www.acme.com/page.php?user=joe&passwd=secret1234

Any ideas?
Jerry Stuckle wrote:
For a post operation, the incoming data will be in the $_POST variable.

In your case you are using the id's "login[email]" and "login[passwd]',
so your values will be in the array as $_POST['login']['email'] and
$_POST['login]['passwd]

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



Brian,

This example is a GET operation (VERY insecure - especially where userid
and passwords are concerned); For that you would use the $_GET array.

The basic differences are:

When a form's method is GET, the values in the form are sent in the URL
(as above) and you use $_GET to access them (in your case, $_GET['user']
would contain 'joe', and $_GET['passwd'] would contain 'secret1234');

Conversely, when a form's method is POST, the values are passed by the
browser but not in the URL. There you would use $_POST, i.e.
$_POST['user'] and $_POST['passwd'].

GET operations are nice for some things because the user can bookmark
the request and return to the same page with the same parameters.
However, the user can also change those parameters before submitting the
page, so it's less secure.

POST, OTOH, doesn't allow the user to bookmark the page *with the posted
parameters*. He/she can only bookmark the URL itself, and any POST
parameters are not available when he/she later tries to use the
bookmark. It is, however, more secure because the user can't as easily
change the parameters before submitting the page.

Another problem with POST is that you can't easily pass these parameters
on if you should need to redirect the user to a new page. But I
recommend you don't worry about that right now; just keep it in mind and
ask more questions later when you need to redirect the user with parameters.

Also, if you have a lot of data on your form, the GET url can become
quite unwieldy. POST urls, OTOH, only contain the URL of the page, so
are shorter.

Personally, I prefer to use POST when possible.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 28 '05 #5
Jerry Stuckle wrote:
br*************@yahoo.com wrote:
Hi and thanks for the tip. However, I'm having a bit of a puzzle trying
to figure out how one can post these variable via the url like:

http://www.acme.com/page.php?user=joe&passwd=secret1234

Any ideas?
Jerry Stuckle wrote:
For a post operation, the incoming data will be in the $_POST variable.

In your case you are using the id's "login[email]" and "login[passwd]',
so your values will be in the array as $_POST['login']['email'] and
$_POST['login]['passwd]

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



Brian,

This example is a GET operation (VERY insecure - especially where userid
and passwords are concerned); For that you would use the $_GET array.

The basic differences are:

When a form's method is GET, the values in the form are sent in the URL
(as above) and you use $_GET to access them (in your case, $_GET['user']
would contain 'joe', and $_GET['passwd'] would contain 'secret1234');

Conversely, when a form's method is POST, the values are passed by the
browser but not in the URL. There you would use $_POST, i.e.
$_POST['user'] and $_POST['passwd'].

GET operations are nice for some things because the user can bookmark
the request and return to the same page with the same parameters.
However, the user can also change those parameters before submitting the
page, so it's less secure.

POST, OTOH, doesn't allow the user to bookmark the page *with the posted
parameters*. He/she can only bookmark the URL itself, and any POST
parameters are not available when he/she later tries to use the
bookmark. It is, however, more secure because the user can't as easily
change the parameters before submitting the page.

Another problem with POST is that you can't easily pass these parameters
on if you should need to redirect the user to a new page. But I
recommend you don't worry about that right now; just keep it in mind and
ask more questions later when you need to redirect the user with
parameters.


What a good explanation!

I see the the OP is apparently dealing with a login. This immediately
raises the question of validation of the posted values and of course the
need to indeed pass variables created by the post method. The answer
lies of course in the use of cookies, or much preferably, sessions.

Louise
Sep 28 '05 #6
brian_mckracken wrote:
I'm trying to construct a url so that the form values are posted in the
url...


http://www.w3.org/2001/tag/doc/whenToUseGet.html

--
Jock
Sep 30 '05 #7

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

Similar topics

4
by: Shailesh | last post by:
Hi! I want to overload << operator so that it can print an arry defined in MyClass.My problem is that I want to print only a no of elements NOT all the elements in the array and this no of...
9
by: Rafi Kfir | last post by:
Hi, This may look as a smiple task to most of you, but to me (a beginner with C), it drives me crazy. All I want is that one function passes a two dimensional array of strings to another...
9
by: sathya | last post by:
I was going through an Boyer-Moore-Horspool pattern match, I saw a array inside a array, like the below, skip ] = patlen - i - 1; The array is decleared as int skip; unsigned char *pat;
11
by: Geoff Cox | last post by:
Hello, I am trying to get a grip on where to place the initialization of two arrays in the code below which was created using Visual C++ 2005 Express Beta 2... private: static array<String^>^...
8
by: nescio | last post by:
hello, i have an array and i don't know the content of it, but i want only unique values. in php there is a function to do this, but how must i do this in javascript? i have tried a lot and...
13
by: sathyashrayan | last post by:
Dear group, pls go through the following function definition: function at_show_aux(parent, child) { var p = document.getElementById(parent); var c = document.getElementById(child); var top ...
9
by: Joe | last post by:
hi. simple question: how can one declare Array (or table) with unknown number of elements, and then assign values to it, example: Dim TableStrings() as String TableStrings(0) = "first value"...
1
by: Arjun234 | last post by:
hi, I have a program to calculate the distance. its like this: open(IN, "/path/outModified.pl") or die "$!"; while (my $line = <IN>) { chomp($line); my @array = (split (/\s+/, $line)); #...
6
by: new2coding | last post by:
Hi everyone, I am brand new to programming and am trying to pick up c++ on my own, with the help of some books and online tutorials. I am a business major and figured knowing how to make some...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.