Jump to content

Recommended Posts

I have 2 issues happening, first one I need to get resolved is, line 60 is giving me a 'Notice: Undefined variable: delete'. This codes had multi issues but was able to resolve all but this one and my table not filling in with the data from my database. If you need any other info please let me know, Again I am new at this.

 

                        <tr>
                        <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit"

                        id="delete value="delete"></td>
                       </tr>

 

                       <?php

                        // Check if delete button active, start this
*line 60* -----> if ($delete){
                       for($i=0;$i<$count;$i++){
                       $del_id = $checkbox[$i];
                       $sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
                       $result = mysqli_query($sql);
                       }

                        // if successful redirect to delete_multiple.php
                       if($result){
                       echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">";
                        }
                        }
                        mysqli_close($con);
                        ?>

The error means the $delete hasn't been set yet. You could use isset() to test the variable:

http://php.net/manual/en/function.isset.php

 

Also, since it looks like that variable is supposed to come from an HTML form, you may want to check out the PHP manual for $_POST and $_GET.

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.