Hi Guru,
I hope you can help me to solve my problems.
I trying to set one check box array and one textbox.
How can i post the checkbox name with the value in the textbox.
Please guide
Hi Guru,
I hope you can help me to solve my problems.
I trying to set one check box array and one textbox.
How can i post the checkbox name with the value in the textbox.
Please guide
You could have an onchange event for the textbox, which would change the value of the checkbox when the textbox contents change with JavaScript.
I have to run, but this should help you:
javascript:document.formName.fieldName.value='your value';
hm.. sounds like a reasoning error, and not a programming problem to me.
WHY would you want to do that? A checkbox is one input element. The textbox something else. Please describe what you are trying to do, and probably there is a simpler way to do this
leatherback wrote:hm.. sounds like a reasoning error, and not a programming problem to me.
WHY would you want to do that? A checkbox is one input element. The textbox something else. Please describe what you are trying to do, and probably there is a simpler way to do this
Hi Leatherback..
What Im trying to do is when user click on checkbox, to select item to buy, he/she also input the amount how many he/she want to buy it in the textbox/formbox. At the same time the checkbox value and tie together with the amount in array.
Can it be like that? Or you can guide me the simplest way to do it..?
Please help me guru..
why cant you send 2 values from form?
one checkbox and one text input with quantity
...and let the recieving page put them together
$item = $_POST['chbox'];
$howmany = $_POST['number'];
$jointhem = $howmany . '-' . $item;
Hi Halojoy,
How about I want to use 2 or more checkbox and formbox?
Please guide
Easiest way to do it when you have multiple instances of the same set of formfields is by using arrays for their names:
<input type="text" name="order[]">
That would result in an array of values in your $POST, starting at:
$_POST['order'][0]
to process you go:
foreach($_POST['order'] as $key=>$order)
{
// Proces each order here, it will go through the array and retrieve each order
// access the checkbox:
$checkvalue = $_POST['checkboxname'][$key];
}
I am not sure whether the checkboxes would 'play fair', as only th eones that are checked are submitted. If they do not increatement their array key properly, you might have to add the 0, 1, 2, etc to the brackets yourself:
<input type="text" name="order[0]">
Hi Leatherback..
Thanks for your code..I use it and it works..
Thanks again.