SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    4
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    delete not working

    PHP Code:
    <?php
     
     
    $con 
    mysql_connect'localhost''root''' );
    $db =  mysql_select_db'regis123' );
     


    if(isset(
    $_POST['sub']))
    {
        
    $sql2="delete from stud where firstname='$_POST[hidden]'";
        
    mysql_query($sql2);
            print 
    ' deleted successfully';
        
    }

    ?>
     <table width="508" border="1">
      <tr>
        <td width="10"><strong>&nbsp;FIRSTNAME</strong></td>
        <td width="30"><strong>&nbsp;LASTNAME</strong></td> 
        <td width="35"><strong>&nbsp;EMAILID</strong></td>
        <td width="30"><strong>&nbsp;DOB</strong></td>
        <td width="20"><strong>&nbsp;GENDER</strong></td>
        <td width="71"><strong>&nbsp;ADDRESS</strong></td>
        <td width="10"><strong>&nbsp;stand</strong></td>
        <td width="10"><strong>&nbsp;PHONE</strong></td>
        </tr>'
    <?php

    $sql 
    "select * from stud";
    $query mysql_query$sql );

    while( 
    $row mysql_fetch_assoc($query) )
    {
    print
    '<form action="sdisplay.php" method="POST">';
    print
    '<tr><td>'.$row["firstname"].'</td>';
    print
    '<td>'.$row["lastname"].'</td>';
    print
    '<td>'.$row["emailid"].'</td>';
    print
    '<td>'.$row["dob"].'</td>';
    print
    '<td>'.$row["gender"].'</td>';
    print
    '<td>'.$row["addr"].'</td>';
    print
    '<td>'.$row["stand"].'</td>';
    print
    '<td>'.$row["phone"].'</td>

    <td><input type=submit value=delete name="sub" /></td>
    <input type=hidden name=hidden value='
    .$row["firstname"].'/></form>';
    }
     
    ?>
    this is my code
    it is retreiving the info frm database and displaying bt deleting the entries is not working
    plz helpme
    Last edited by SpacePhoenix; Oct 1, 2013 at 22:30. Reason: placed php tags around php code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •