delete button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bazubwabo
    New Member
    • Nov 2006
    • 14

    delete button

    hi everybody,
    there is someone who can help me to find out how to create a delete button .Indeed,I have then 2 buttons, one for insert(works well),second one is therefore for to delete.
    You can check out below the code:[php]
    ?>
    <?php

    if(isset($_POST['Delete'])){
    $query="DELETE FROM SCANNER WHERE SCANNER.scanNo ='".$scanNo."'" ;
    $result=mysql_q uery($query);
    }
    ?>
    <form action="procesc anin.php" method="get" name="scanin_fo rm">
    <div align="center">
    <table>
    <tr><td> scannerNummer:</td>
    <td> <input name="scanNo" type="text" ></td><td>&nbsp;</td>
    </tr>
    <tr><td>Type: </td>
    <td> <input name="type_id" type="text" ></td><td>&nbsp;</td>

    </tr>
    <tr><td>&nbsp ;</td><td><input name="Insert" type="submit" value="Insert" ></td>
    <td>&nbsp;</td><td><input name="Delete" type="submit" value="Delete"> </td>
    <td>&nbsp;</td><td><input type="hidden" name="For_to_de lete" value="<?php echo $_REQUEST["scanNo"];?>"> </td>

    </tr>
    </table>
    </div>
    </form>[/php]
    At the end when i click on delete,it acts as insert button.

    Regards,
    Bazubwabo J.B.
    IT student
    Last edited by ronverdonk; Jan 10 '07, 11:49 PM. Reason: enclose code within tags
  • b1randon
    Recognized Expert New Member
    • Dec 2006
    • 171

    #2
    Originally posted by bazubwabo
    hi everybody,
    there is someone who can help me to find out how to create a delete button .Indeed,I have then 2 buttons, one for insert(works well),second one is therefore for to delete.
    You can check out below the code:[php]
    ?>
    <?php

    if(isset($_POST['Delete'])){
    $query="DELETE FROM SCANNER WHERE SCANNER.scanNo ='".$scanNo."'" ;
    $result=mysql_q uery($query);
    }
    ?>
    <form action="procesc anin.php" method="get" name="scanin_fo rm">
    <div align="center">
    <table>
    <tr><td> scannerNummer:</td>
    <td> <input name="scanNo" type="text" ></td><td>&nbsp;</td>
    </tr>
    <tr><td>Type: </td>
    <td> <input name="type_id" type="text" ></td><td>&nbsp;</td>

    </tr>
    <tr><td>&nbsp ;</td><td><input name="Insert" type="submit" value="Insert" ></td>
    <td>&nbsp;</td><td><input name="Delete" type="submit" value="Delete"> </td>
    <td>&nbsp;</td><td><input type="hidden" name="For_to_de lete" value="<?php echo $_REQUEST["scanNo"];?>"> </td>

    </tr>
    </table>
    </div>
    </form>[/php]
    At the end when i click on delete,it acts as insert button.

    Regards,
    Bazubwabo J.B.
    IT student
    Post the rest of your code. Also, you may want to include a hidden field called "function" and use javascript to write "insert" or "delete" in the value that way you can test just the one field. Getting the value of your submit buttons may be tricky.

    Comment

    Working...