AikenDrum Posted May 25, 2007 Share Posted May 25, 2007 Hi guys this has to be one of the busiest forums I have visited ! Perhaps someone can help me remove elements from an Array ? My current code is below. I can unset parts of the element, for example, if I use unset $salesListData['Name'][0]; then the Name will be blank, but the other parts of the form are still present. Any brainwaves ? Many thanks in Advance AikenD <?php if( is_array( $arrData ) ) { foreach($arrData as $key=>$salesListData) { if( $salesID==$salesListData['salesID'][0]) echo $salesListData['RowID'][0]; //shold unset the element here, but does not work ?> <form id="SalesDetail" action="SalesDetail.php" method="post"> <input type="hidden" name="salesID" value="<?php echo $salesID ?>"> <input type="submit" value="<?php echo $salesListData['Name'][0]; ?>" > <td><input type="image" name="submit" src="<?php echo $img;?>"></td> </form> <?php } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52963-removing-array-elements/ Share on other sites More sharing options...
taith Posted May 25, 2007 Share Posted May 25, 2007 how bout this? also... why you got the td's in there... its not in a table... <?php if(is_array($arrData)){ foreach($arrData as $key=>$salesListData) { if( $salesID==$salesListData['salesID'][0]){ unset($salesListData['RowID'][0]); //i think you meant to unset, not echo continue; } ?> <form id="SalesDetail" action="SalesDetail.php" method="post"> <input type="hidden" name="salesID" value="<?php echo $salesID ?>"> <input type="submit" value="<?php echo $salesListData['Name'][0]; ?>" > <td><input type="image" name="submit" src="<?php echo $img;?>"></td> </form> <?php } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52963-removing-array-elements/#findComment-261585 Share on other sites More sharing options...
AikenDrum Posted May 25, 2007 Author Share Posted May 25, 2007 MANY Thanks, exactly what I needed AikenD Quote Link to comment https://forums.phpfreaks.com/topic/52963-removing-array-elements/#findComment-261594 Share on other sites More sharing options...
taith Posted May 25, 2007 Share Posted May 25, 2007 enjoy! Quote Link to comment https://forums.phpfreaks.com/topic/52963-removing-array-elements/#findComment-261595 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.