473,835 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.p hp?expand=0,100 00' 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?expan d0,10000&login[email]=j**@mail.com&l ogin[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 10990
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.p hp?expand=0,100 00' 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?expan d0,10000&login[email]=j**@mail.com&l ogin[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*******@attgl obal.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*******@attgl obal.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*******@att global.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*******@attgl obal.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*******@attgl obal.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
2539
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 elements depends upon user input.The code below describes this in detail: class MyClass { public: unsigned short x;
9
2739
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 function. example: NOTE: the strings can be of different length and the array will be
9
3390
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
2272
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^>^ LHSquestions = gcnew array<String^> {"question 1","question 2"}; private: static array<String^>^ RHSquestions = gcnew array<String^> {"question 1",
8
18601
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 it is driving me nuts
13
1719
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 = (c == "y") ? p.offsetHeight+2 : 0; var left = (c == "x") ? p.offsetWidth +2 : 0;
9
3529
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" TableStrings(1) = "second" TableStrings(2) = "tird" .... etc
1
2397
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)); # print "@array\n"; push @points, ;
6
1671
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 basic programs might help me when crunching numbers. Basically, what i am trying to do is use an array (i think thats what i need) to take a set of numbers from from a user and do different calculations on them, I know that there wont be any more...
0
9652
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10811
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10523
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10560
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10233
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5636
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3088
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.