0

Let's say you've got a form with check boxes like below:

<form method="post" action="path to script">
<input type="textbox" id="text[]" value="" /> ***
<input type="textbox" id="text[]" value="" /> ***
<input type="textbox" id="text[]" value="" /> ****
<input type="textbox" id="text[]" value="" /> ****
</form>

Edited by pritaeas: Added markdown.

4
Contributors
4
Replies
18
Views
4 Years
Discussion Span
Last Post by diafol
0

I will recode your code
I assume this is text box not like on your title that is checkbox
I hope it will be a help to you

<html>
<body>
<form action="<?php htmlspecialchars($_SERVER['PHP_SELF']);?>" method="POST">
<?php
for($i=0,$i<5,$i++){
//this will out put text boxes with the loop of 5... and will be used further in looping the array
echo "<input type='text' name='text[]'><br/>";
}
?>
<input type="submit" value="GO">
</form>
</body>
<html>
<?php
// here goes the $_SERVER['PHP_SELF']
// count the array
$number=0;
//use for each to retrieve the values of an array per loop
foreach($_POST['text'] as $arrayCount){
echo $number+1.".)".$arrayCount;
}
?>

Edited by masterjiraya

0

hi.. bradly.spicer you not unserstand that question or code..
sorry i'm changed the code before post the perivous code is here

<form method="post" action="path to script">
<input type="checkbox" id="colors[]" value="red" /> Red
<input type="checkbox" id="colors[]" value="blue" /> Blue
<input type="checkbox" id="colors[]" value="green" /> Green
<input type="checkbox" id="colors[]" value="yellow" /> Yellow
</form>
0

How do you want the data stored? As a serialised list, discrete fields?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.