Page 1 of 1

sending two values at once

Posted: Sun Jun 06, 2004 4:21 pm
by hward
what am i missing here??

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

Posted: Sun Jun 06, 2004 4:24 pm
by John Cartwright
deleted.

Posted: Sun Jun 06, 2004 4:31 pm
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

Posted: Sun Jun 06, 2004 7:23 pm
by launchcode
what am i missing here??
An understanding of basic HTML? ;)

Posted: Sun Jun 06, 2004 8:45 pm
by dull1554
lol
.... true true

Posted: Mon Jun 07, 2004 1:14 am
by feyd
last I checked & inside a value will get urlencoded..

Posted: Mon Jun 07, 2004 1:22 am
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'>

Posted: Mon Jun 07, 2004 1:26 am
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';

Posted: Mon Jun 07, 2004 2:32 am
by qads
just have a hidden field for each value?..as said above, use arrays? read some tutorials on html aswell :P

Posted: Mon Jun 07, 2004 5:45 am
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);