Jump to content

Problems with my while loop and also cant delete its corresponding rows on a click of the buttton delete


crack576

Recommended Posts

 <body>
 
 
  <?php
    

 
       include 'sql.php';
       $query = "SELECT * FROM validation";
       $result = mysqli_query($con , $query);  
       $rows = mysqli_fetch_assoc($result) ;
       $totals = mysqli_num_rows($result) ;
   
      
      
          ?>
            <div id="css">
    <form >
       <table width="80%" border="0" cellpadding="2" cellspacing="2" >
          <caption><h2>Personal Details of Customers</h2></caption>
          <tr class="white">
              <td bgcolor="#330033">   </td>
              <td bgcolor="#330033"> Id Number </td>
              <td bgcolor="#330033"> Full Name </td>
              <td bgcolor="#330033"> Email Address </td>
              <td bgcolor="#330033"> Website </td>
              <td bgcolor="#330033"> Comment </td>
              <td bgcolor="#330033"> Time </td>   
     
</tr>
       <?php while($rows=mysqli_fetch_assoc($result)
       {
       <tr>
      
      <input type="raido" name="ID" value="<?php echo $rows['ID']; ?>"  />
      <td bgcolor="#FFFFCC"><?php  echo $rows['ID'];?></td>
      <td bgcolor="#FFFFCC"><?php  echo $rows['Name'];?> </td>
      <td bgcolor="#FFFFCC"><?php  echo $rows['Email'];?></td>
      <td bgcolor="#FFFFCC"><?php  echo  $rows['Website'];?></td>
      <td bgcolor="#FFFFCC"><?php  echo $rows['Comment'];?></td>
      <td bgcolor="#FFFFCC"><?php  echo $rows['Time'];?></td>  
      
       <td> </td>
     
       <td> <a href="delete.php? ID= "$rows[ID]" /"> <input type="submit" name="del" value="Delete" /> </a>                                                       <input type="button" name=   "edit" value="Edit"  /> </td>
       </tr>
              } 

?>
 
     </table>
   </form>
  </div>
 
 </body>

Link to comment
Share on other sites

It'd be nice if you spent the bit of time it takes to write a description of your problem, rather than just use the one-line title to cram everything in. Leaves us with questions like "What problems with your while loop?"

 

As for the other issue,

 
Putting aside the malformed HTML,

You can't put a button inside a link. Pick one. However if you need to pass a value then you can use a like

To make that work, though, you need the current script (the one that handles editing) to support deletes too - can't have a form inside a form, and shouldn't try to switch the action of a form based on a button. There's HTML 5 stuff you could do, actually, but I probably wouldn't.
Link to comment
Share on other sites

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.