everything works now but i have another problem: if i check no boxes and hit the submit button i get errors on the second form where i loop through so:
how can i loop through on the "controlling form" to check if any boxes was checked and THEN enable the submit button otherwise i disable it...as the form 1st open no boxes are checked obviously but as soon as i start checking boxes i want submit button to show...
my code:
<form action="<?php echo url_for('doc/document'); ?>" method="post">
<input type='hidden' name='service_id' value='<?php echo $service->getId() ?>'>
<table width='1000px' border='0' cellspacing='0'>
<tr>
<td class='td_header_2' align='left' colspan='2' width='50%'>
Available products for service: <?php echo $service->getName()?>
</td>
</tr>
<tr>
<table width='600px' class='tbl_content_box' border='0' cellspacing='0'><?php
$product_names = LpmPagePeer::getByAllProdNames($service->getId());
foreach($product_names as $product_row) { ?>
<tr>
<td > </td><td width='200px'><?php echo $product_row->getName(); ?></td>
<td width='200px'><input type="checkbox" name=[COLOR="Red"]"graphic[]" value[/COLOR]="<?php echo $product_row->getId();?>" /></td>
<td width='200px'><input type="checkbox" name=[COLOR="red"]"text[]" [/COLOR] value="<?php echo $product_row->getId();?>" /></td>
</tr>
<?php }
?>
</table>
<table>
<tr>
<td>
<?php
[COLOR="red"] $graphics_selected = $_POST['graphic']; //get error here
foreach($graphics_selected as $val) //and here see bottom of code for errors pls[/COLOR]
{
if ( (isset($graphic)) || (isset($text) ))
{
echo "checkboxes checked"; ?>
<input type='hidden' name='submit' value='Submit'>
<?php
//show submit button
}
else
{
//hide submit botton and
echo "no boxes check";
}
}
?>
</td>
</tr>
</table>
</form>
errors:
Notice: Undefined index: graphic in /home/helloises/svn_wappool/apps/lpmanager/modules/doc/templates/productSuccess.php on line 36 Warning: Invalid argument supplied for foreach() in /home/helloises/svn_wappool/apps/lpmanager/modules/doc/templates/productSuccess.php on line 37
please help me with this code
thanks