Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get variable from input field php

Tags:

php

im creating this page http://derdour.fr/token/1/

and this is the source code :

<?php error_reporting(0);include_once"\x63l\x61s\x73/\x64eviceC\x6ca\x73\x73\x2e\x70\x68\x70";

    function string_between_two_string($str, $starting_word, $ending_word) 
{ 
    $subtring_start = strpos($str, $starting_word); 
    //Adding the strating index of the strating word to 
    //its length would give its ending index 
    $subtring_start += strlen($starting_word); 
    //Length of our required sub string 
    $size = strpos($str, $ending_word, $subtring_start) - $subtring_start; 
    // Return the substring from the index substring_start of length size 
    return substr($str, $subtring_start, $size); 
} 





?>


<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="js/common.js" type="application/javascript"></script>
    <link href="css/common.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Baloo+Tamma+2:wght@500&display=swap" rel="stylesheet">
    <style>
#check {
    font-family: 'Baloo Tamma 2', cursive;
  background-color: black; /* Green */
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}
#clear {
    font-family: 'Baloo Tamma 2', cursive;
    background-color: #4CAF50; /* Green */
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

        .error{
            color:red;
        }
        input[type='text']{
            width:60%;
            padding:10px;
        }
    
  #formz {
    font-family: 'Baloo Tamma 2', cursive;
    width: 70%;
  border-radius: 0px;
  background-color: #f2f2f2;
  padding: 20px;
}
input[type=text], select {
    font-family: 'Baloo Tamma 2', cursive;
  width: 70%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Baloo Tamma 2', cursive;
}

/* Style the side navigation */
.sidenav {
  height: 100%;
  width: 200px;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #111;
  overflow-x: hidden;
}


/* Side navigation links */
.sidenav a {
  color: white;
  padding: 16px;
  text-decoration: none;
  display: block;
}

/* Change color on hover */
.sidenav a:hover {
  background-color: #ddd;
  color: black;
}

/* Style the content */
.content {
  margin-left: 200px;
  padding-left: 20px;
}

    </style>
</head>
<body>
<div class="sidenav">  
<a href="#"><h3> DERDOUR Unlock <br> PREMIUM FMI OFF </h3></a>
  <a href=""> Instagram @id.2105</a>
</div>

<div class="content">
<div id="formz">
<form id="form">
    
      <label for="text">T O K E N </label> <br>
    <input type="text"  id="tokeninput"><br>
    <span id="tokenin_error" class="error"></span>
    <br>
    
 
    
    <input type="hidden" name="appToken" id="appToken" value="<?PHP echo $appToken; ?>" ><br>
    <span id="appToken_error" class="error"></span>
    <br>
    
    <input type="hidden" name="md" id="md" value="<?PHP echo $md; ?>" class=""><br>
    <span id="md_error" class="error"></span>
    <br>

    <input type="hidden" name="mdm" id="mdm" value="<?PHP echo $mdm; ?>" class="">
    <br>
    <span id="mdm_error" class="error"></span>
    <br>
    <input type="button" id="check" value="CHECK">&nbsp;
    <input type="reset" id="clear" value="CLEAR">
    <br>
    <div id="result"></div>
</form>
</div>
</div>

<script>
var 
</body>
</html>

i want to make $tokenin from the tokeninput in the html form

PS : when i changed : $tokenin = $_GET['tokeninput'];

to

$tokenin = 'ewogICAgIkRhdGEiIDogIklBQUFBQUFBQkx3SUFBQUFBRjU1S05VUkRtZHpMbWxq Ykc5MVpDNWhkWFJvdlFBbVNnb2JVTVZrZFNDR29BdDBCaU5aWjdOeVZObE1HVkJX b016WDRyZzhMMktIRTM1RklDMmFG...not full';

everything worked perfectly

but when i use my code when i inspect the browser i see the values are empty thank you for your help :)

like image 255
Abdallah Avatar asked Feb 17 '26 00:02

Abdallah


1 Answers

Your problem has nothing to do with PHP, by the way. Change this

<input type="text"  id="tokeninput">

to this

<input type="text" name="tokeninput" id="tokeninput">

The id attribute is for identifying the element programmatically. You need a name attribute for identifying the submitted form data.

like image 197
Don R Avatar answered Feb 18 '26 13:02

Don R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!