Page 1 of 1

foreach Not Working

Posted: Fri Oct 05, 2007 3:58 am
by Harlequin
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi guys

Need some help with some post data, any suggestions gratefully received...

Form Code:

[syntax="html"]
<input type="hidden" name="Id" value="<?php echo $row['Id']; ?>" />
   <input type="hidden" name="Brand" value="<?php echo $row['Brand']; ?>" />
   <input type="hidden" name="Description" value="<?php echo $row['Description']; ?>" />
   <input type="text" name="Qty" size="2" maxlength="2" />
Target Code:[/syntax]

Code: Select all

if (is_array($_POST['Id']))
   {
   echo 'You selected: <br />';

   foreach ($_POST['Id'] as $a)
      {
      echo "<i>$a</i><br />";
      }
   }

   else
   {
   echo 'Nothing selected';
   }
Any ideas guys...?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Oct 05, 2007 5:11 am
by aceconcepts
Change the name of your "Id" element to

Code: Select all

name="Id[]"