Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9239027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:53:38+00:00 2026-06-18T07:53:38+00:00

I wanted to get value by clicking button. But it isn’t working. Here is

  • 0

I wanted to get value by clicking button. But it isn’t working. Here is my code:

players.php

(header)

    <?php
kick_ban(@$_POST['submit']);
getMsg();
?>

(Form)

<form method="POST" action="?go=players">
<input type="submit" name="kick" class="btn btn-warning" type="button" value="Wyrzuć" />
<input type="submit" name="ban" class="btn btn-danger" type="button" value="Zbanuj" />
<?php $idgracza = $sValue['playerid'] ?>
</form>

functions_admin.php

function kick_ban($post) {
    require_once "../inc/SampRcon.class.php";
        $config = getData('../inc/config.php');
        $port = $config['port'];
        $adrip = $config['adresip'];
        $query2 = new SampRcon(''.$adrip.'', $port, "Modding1");
        if ($query2->connect()) {
        if(isset($_POST['kick'])){
        $query2->kick($idgracza);
        $_SESSION['success'] = 'Gracz o id '.$idgracza.' został pomyślnie wyrzucony z serwera.';
        }
        if(isset($_POST['ban'])){
        $query2->ban($idgracza);
        $_SESSION['success'] = 'Gracz o id '.$idgracza.' został pomyślnie zablokowany.';
        }
        }
        else
        {  
        $_SESSION['error'] = 'Błąd';
        }
        $query2->close(); // Close the connection
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:53:39+00:00Added an answer on June 18, 2026 at 7:53 am

    One problem is this line:

    kick_ban(@$_POST['submit']);
    

    You are only sending the submit variable (which is actually undefined) to the function.
    What you want is this:

    kick_ban($_POST);
    

    Now I’m not saying this is a good way to code but that will send the whole post array into your function so you can access all the variables.

    Another issue is when you try to access things in the kick_ban function:

    $_POST['kick']
    

    and

    $_POST['ban']
    

    should be:

    $post['kick'] 
    

    and

    $post['ban']
    

    The reason is that once you pass them into the kick_ban function the name of the array becomes $post instead of $_POST.

    You need a hidden input to add $idgracza to the form:

    <input type='hidden' name='idgracza' value = '".$sValue['playerid']."'>
    

    Then access it in your kick_ban function: $post['idgracza']

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m working with maplet and wanted to get the parameter value of my
Wanted a simple but efficient method to get value from Nullable when T is
I wanted to get the axisLabel value by clicking on it to plot a
I wrote a program in C# where I wanted to get a value from
I wanted to get the keyCode on keydown event in ckeditor. My code looks
When I wanted to get Android source code, I knew that I have to
I wanted to get the value of a Numeric cell as a simple string.
I wanted to grab the value on an ajax call using a function. but
i wanted to get the value of a hidden div in jquery i.e. <div
i wanted to get the value of a TextBox in a form and use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.