Jump to content

Recommended Posts

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

}

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/52963-removing-array-elements/
Share on other sites

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
}
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.