Hello. I have and event.php page and del_single.php page. event page has a form:

<form action='del_single.php' method='get'>//<-i already have the method as get
    <input type='hidden' name='event_id' value='$id'>
    <input type='checkbox' name='check[]' class='check' value='$id'>
    <a href= '#' value='$id' name='e_n' onclick='getsum(".$id.")' >$name</a>
    <input type='submit' name='del_single_event' value='Delete'>

as you can see i have the form to be processed on a different page which is the del_single.php:

        require "connection.php";
        $userid = $_SESSION['sess_user_id'];
        $id = $_GET['event_id'];//<-get id
        $sqlqueer = $dbh->prepare("DELETE FROM event WHERE event_id = :id AND euser_id = :userid");
        $sqlqueer->bindParam(':id', $id, PDO::PARAM_INT);
        $sqlqueer->bindParam(':userid', $userid, PDO::PARAM_INT);

        if($sqlqueer->rowCount() > 0)
            echo '<script type="text/javascript">window.location.href = "event.php";</script>';

but im getting in the url when delete button clicked:
http://localhost/EMS2/del_single.php?event_id=50&del_single_event=Delete and no deletion occuring.

previously everything was in one page; event.php, and the deletion worked. now im just trying the different page thing and lo behold i can't get it. i googled and there was a solution on stackoverflow but its not working for me. what's wrong with my codes? am i missing something?


Edited by nadiam: edit title

3 Years
Discussion Span
Last Post by cereal

Place session_start() on top of this script otherwise $_SESSION won't be loaded and the IF statement will return false. Bye!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.