Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7189143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:14:19+00:00 2026-05-28T19:14:19+00:00

I am trying to implement a UI which the user would be able to

  • 0

I am trying to implement a UI which the user would be able to select entries by selecting checkboxes to delete them from the database. However, while everything looks fine and able to display, there is an error saying Notice: Undefined variable: delete in /opt/uiForm.php on line 154 whereas $delete is not readable. I am following the example given here. Am I missing anything?

<body>

<form name="frm" method="get" action="doSubmit();">


<?php

// Connect to server and select database.
 mysql_connect("127.0.0.1:3306", "root", "")or die("cannot connect"); 
 mysql_select_db("PushApplication")or die("cannot select DB");

$sql="SELECT * FROM Device";
 $result=mysql_query($sql);

$count=mysql_num_rows($result);

?>
 <table width="400" border="0" cellspacing="1" cellpadding="0">
 <tr>
 <td><form name="form1" method="post" action="">
 <table width="400" border="0" cellspacing="1" bgcolor="#CCCCCC">

 <tr>
 <td align="center" bgcolor="#FFFFFF">#</td>
 <td align="center" bgcolor="#FFFFFF"><strong>ID</strong></td>
 <td align="center" bgcolor="#FFFFFF"><strong>DeviceID</strong></td>
 <td align="center" bgcolor="#FFFFFF"><strong>DeviceType</strong></td>
 <td align="center" bgcolor="#FFFFFF"><strong>Description</strong></td>
 <td align="center" bgcolor="#FFFFFF"><strong>OS_Version</strong></td>
 <td align="center" bgcolor="#FFFFFF"><strong>Status</strong></td>

 </tr>
<?php
 while($rows=mysql_fetch_array($result)){
 ?>
 <tr>
 <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['ID']; ?>"></td>
 <td bgcolor="#FFFFFF"><? echo $rows['ID']; ?></td>
 <td bgcolor="#FFFFFF"><? echo $rows['DeviceID']; ?></td>
 <td bgcolor="#FFFFFF"><? echo $rows['DeviceType']; ?></td>
 <td bgcolor="#FFFFFF"><? echo $rows['Description']; ?></td>
 <td bgcolor="#FFFFFF"><? echo $rows['OS_Version']; ?></td>
 <td bgcolor="#FFFFFF"><? echo $rows['Status']; ?></td> 
 </tr>
<?php
 }
 ?>
 <tr>
 <td colspan="7" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
 </tr>
<?php
// Check if delete button active, start this
 if($delete){
 for($i=0;$i<$count;$i++){
 $del_id = $checkbox[$i];
 $sql = "DELETE FROM Device WHERE ID='$del_id'";
 $result = mysql_query($sql);
 }

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

</form>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:14:21+00:00Added an answer on May 28, 2026 at 7:14 pm

    You really should be using

    if (!empty($_POST['delete'])) {
    

    instead of

    if ($delete) {
    

    to avoid the notice you are getting. Also your code is prone to the so called SQL injection vulnerability which you read upon if you are considering to put it somewhere on the web.

    Also you should be using method="post" instead of GET for this type of operations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Cocoa, I am trying to implement a button, which when the user clicks
I am trying to implement the blackberry application which will help the user to
I am basically trying to return from a method which reads user input from
I'm trying to implement key-press functionality which will remove a div when the user
Im trying to grab a HTML source code from a webpage which needs user
I'm trying to implement a link list which stores the city name (though you
I am trying to implement NOT NULL constraint in the customer table which is
I'm trying to implement (as a prototype initially), a richtextbox control which can be
I'm trying to figure out which of these interfaces I need to implement. They
I am trying to implement a fulltext search on two columns which I created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.