Hi,
What i want is to have a checkbox area where the items i select are stored in a array. Im guessing there should be a some code to find out what has been checked.
Any help with this would be greatly appreciated.

echo '<form action="myown3.php" method="post" name="domaintest" action="_self">';
	
	echo '<input name="submitform" type="submit" value="Submit Domain Info">';
		foreach($domains->domainName as $value) {
echo (' <label><input type="checkbox" name="domain_custom" value="'.$value.'" id="'.$value.'">'.$value.'</label><br>');
		}	
	echo '</form>';

Recommended Answers

All 4 Replies

using arrays we can store multiple values. for array see w3school .com tutorial

Hi,
What i want is to have a checkbox area where the items i select are stored in a array. Im guessing there should be a some code to find out what has been checked.
Any help with this would be greatly appreciated.

echo '<form action="myown3.php" method="post" name="domaintest" action="_self">';
	
	echo '<input name="submitform" type="submit" value="Submit Domain Info">';
		foreach($domains->domainName as $value) {
echo (' <label><input type="checkbox" name="domain_custom" value="'.$value.'" id="'.$value.'">'.$value.'</label><br>');
		}	
	echo '</form>';

are you looking for this?

$box=$_POST['box'];

while (list ($key,$val) = @each ($box)) {
echo "$val,";
}

echo "<form method=post action=''>";
echo "<table border='0' cellspacing='0' style='border-collapse: collapse' width='100' >
<tr bgcolor='#ffffff'>
<td width='25%'><input type=checkbox name=box[] value='John'></td>
<td width='25%'>&nbsp;John</td>
<td width='25%'><input type=checkbox name=box[] value='Mike'></td>
<td width='25%'>&nbsp;Mike</td>
<td width='25%'><input type=checkbox name=box[] value='Rone'></td>
<td width='25%'>&nbsp;Rone</td>
</tr>
<tr bgcolor='#f1f1f1'>
<td width='25%'><input type=checkbox name=box[] value='Mathew'></td>
<td width='25%'>&nbsp;Mathew</td>
<td width='25%'><input type=checkbox name=box[] value='Reid'></td>
<td width='25%'>&nbsp;Reid</td>
<td width='25%'><input type=checkbox name=box[] value='Simon'></td>
<td width='25%'>&nbsp;Simon</td>
</tr>

<tr><td colspan =6 align=center><input type=submit value=Select></form></td></tr>
</table>";

are you looking for this?

$box=$_POST['box'];

while (list ($key,$val) = @each ($box)) {
echo "$val,";
}

echo "<form method=post action=''>";
echo "<table border='0' cellspacing='0' style='border-collapse: collapse' width='100' >
<tr bgcolor='#ffffff'>
<td width='25%'><input type=checkbox name=box[] value='John'></td>
<td width='25%'>&nbsp;John</td>
<td width='25%'><input type=checkbox name=box[] value='Mike'></td>
<td width='25%'>&nbsp;Mike</td>
<td width='25%'><input type=checkbox name=box[] value='Rone'></td>
<td width='25%'>&nbsp;Rone</td>
</tr>
<tr bgcolor='#f1f1f1'>
<td width='25%'><input type=checkbox name=box[] value='Mathew'></td>
<td width='25%'>&nbsp;Mathew</td>
<td width='25%'><input type=checkbox name=box[] value='Reid'></td>
<td width='25%'>&nbsp;Reid</td>
<td width='25%'><input type=checkbox name=box[] value='Simon'></td>
<td width='25%'>&nbsp;Simon</td>
</tr>

<tr><td colspan =6 align=center><input type=submit value=Select></form></td></tr>
</table>";

Yea something like that, but there are over 2000 domain names and more and more are added all the time.

Great help muralikalpana,

This is the code i got so far

$box=$_POST['box'];

while (list ($key,$val) = @each ($box)) {
echo "$val,";
}

echo "<form method=post action=''>";
foreach($domains->domainName as $value) {
echo "<input type=checkbox name=box[] value='".$value."'>";
echo "&nbsp;".$value."<br>";
}
echo "<input type=submit value=Select></form>";

There are over 2000 domain names so i was wondering if there is a way to format it in a table so once it reaches something like 200 domains the table will continue on a second column and so on...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.