Hello. right following this post that i posted up just now, i wanted to edit the question but then i couldn't anymore. sorry if that annoys anyone.

anyway, i was thinking of putting all the php scripts into one page and googled and found this on stackoverflow and implemented it as needed:

<?php
if(!isset($_GET['action']))
{
    $action = "event.php";
}
else
{
    $action = $_GET['action'];
}

switch($action)
{
    case 'multiple' :
        del_multiple('confirm("Are you sure?")');
    break;
    case 'single' :
        del_single('confirm("Are you sure?")');
    break;
}

function del_single()
{
    if(isset($_SESSION['sess_user_id']))
    {
            require "connection.php";
            $userid = $_SESSION['sess_user_id'];
            $id = $_GET['event_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);
            $sqlqueer->execute();

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

function del_multiple()
{
    if(isset($_SESSION['sess_user_id']))
    {
        require "connection.php";
        $del_id=$_POST['check'];
        $M = count($del_id);
        $sess = $_SESSION['sess_user_id'];

        $results = $dbh->prepare("DELETE FROM event WHERE event_id= :memids AND euser_id= :id");

        for($j=0; $j < $M; $j++)
        {
            $results->bindParam(':memids', $del_id[$j]);
            $results->bindParam(':id', $sess);
            $results->execute();

            if($results->rowCount() > 0)
            {

                echo '<script type="text/javascript">alert("Event deleted!")</script>';
            }
        }
    }
}
?>

and the buttons on event.php page:

<input type="submit" name="del_event" value="Delete Selected Event" href="deletion.php?action=multiple" disabled/>
<input type='submit' class='del_single_event' name='del_single_event' value='Delete' href='deletion.php?action=single'>

i wanna know if what i have done is correct i mean its not like i changed much i just want an opinion. because as of right now in my other post that i linked i can't get that to work yet and having modified the whole page im not sure if it will run or not. coz right now i just get linked to a blank deletion.php page(i changed the name of the page) and nothing happening. so yeah.

TIA

<?php 

/*
*  Create a simple sub options page called 'Footer'
*/

if( function_exists('acf_add_options_sub_page') )
{
    acf_add_options_sub_page( 'Footer' );
}

/*
*  Create an advanced sub page called 'Footer' that sits under the General options menu
*/

if( function_exists('acf_add_options_sub_page') )
{
    acf_add_options_sub_page(array(
        'title' => 'Footer',
        'parent' => 'options-general.php',
        'capability' => 'manage_options'
    ));
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.