sending two values at once

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

sending two values at once

Post by hward »

what am i missing here??

<input type=hidden name=disks value='option1' and 'option2'>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

deleted.
Last edited by John Cartwright on Sun Jun 06, 2004 7:52 pm, edited 1 time in total.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

acctually if your gonna use post in your form you could do this

Code: Select all

<input type=hidden name=blah value="123&blah1=456">
once the form was submitted it would be like this

Code: Select all

URL: www.blah.com?blah=123&blah1=456
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

what am i missing here??
An understanding of basic HTML? ;)
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

lol
.... true true
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

last I checked & inside a value will get urlencoded..
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

you could put it in an array

<input type=hidden name=disks[] value='option1'>
<input type=hidden name=disks[] value='option2'>

or just have 2 hidden
<input type=hidden name=disks1 value='option1'>
<input type=hidden name=disks2 value='option2'>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

dull1554 wrote:acctually if your gonna use post in your form you could do this

Code: Select all

<input type=hidden name=blah value="123&blah1=456">
once the form was submitted it would be like this

Code: Select all

URL: www.blah.com?blah=123&blah1=456
just checked on it real quick:
a value of "123&blah1=456" will change to "123%26blah1%3D456" in the submit.. resulting in:
$_GET['blah'] = '123&blah1=456';
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

just have a hidden field for each value?..as said above, use arrays? read some tutorials on html aswell :P
dave420
Forum Contributor
Posts: 106
Joined: Tue Feb 17, 2004 8:03 am

Post by dave420 »

The easiest way is to use a seperator in the value, then split on that back in your PHP. Using a hidden variable works, yet can create excessive overhead for what is a trivial operation.

Code: Select all

&lt;input type=hidden name="blah" value="one|two|three"&gt;
which can be broken up in PHP like this:

Code: Select all

list($one, $two, $three)=explode("|", $_GET["blah"], 3);
Post Reply