Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

keroherox10's avatar

Undefined index: imei

I WANT TO fix this probelm Blade.view

@extends('admin.layouts.app')
@section('panel')


<center>
	<form method="POST" action="" style="margin-top:5%">
		<p><input type="text" style="padding: 15px 10px 10px; font-family: 'Source Sans Pro',arial,sans-serif; border: 1px solid #cecece; color: black;box-sizing: border-box; width: 50%; max-width: 500px;" name="imei" autocomplete="off" maxlength="50" placeholder="Write here IMEI or SN"></p>
		<select name="service" id="service" style="padding: 15px 10px 10px; font-family: 'Source Sans Pro',arial,sans-serif; border: 1px solid #cecece; color: black;box-sizing: border-box; width: 50%; max-width: 500px;">
			<option value="0" selected="selected">PLEASE CHOOSE CHECKER</option>
			<optgroup label="GENERIC SERVICES">
				<option value="19">0.05 - LG INFO &#x26A1;</option>
				<option value="24">0.02 - ZTE INFO &#x26A1;</option>
				<option value="5">0.02 - SONY INFO &#x26A1;</option>
				<option value="23">0.05 - ACER INFO &#x26A1;</option>
				<option value="34">0.05 - ASUS INFO &#x26A1;</option>
				<option value="39">0.05 - OPPO INFO &#x26A1;</option>
				<option value="45">0.04 - ITEL INFO &#x26A1;</option>
				<option value="2">0.10 - NOKIA INFO &#x26A1;</option>
			</optgroup>
		</select>
		<br /><br />
		<button onClick="this.form.submit(); this.disabled=true; this.value='Please Wait'; " type="submit" style="background-color: #2ABCA7; padding: 12px 45px; -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; border: 1px solid #2ABCA7;-webkit-transition: .5s; transition: .5s; display: inline-block; cursor: pointer; width: 20%; max-width: 200px; color: #fff;">Submit</button>
	</form>

</center>

<?php
$format = "html"; // Display result in JSON or HTML format
$imei = $_POST['imei']; // IMEI or SERIAL Number
if(!filter_var($imei, FILTER_VALIDATE_EMAIL)){$imei = preg_replace("/[^a-zA-Z0-9]+/", "", $imei);} // Remove unwanted characters for IMEI/SN
$service = $_POST['service']; // Service ID
if($service != 'demo'){$service = preg_replace("/[^0-9]+/", "", $service);} // Remove unwanted characters for Service ID
$api = "WRITE-HERE-API-KEY"; // Sickw.com APi Key

if(isset($_POST['service']) && isset($_POST['imei'])){
if(strlen($api) !== 31){echo "<font color=\"red\"><b>API KEY is Wrong! Please set APi KEY!</b></font>"; die;}
if(strlen($service) > 4 || $service > 250){echo "<font color=\"red\"><b>Service ID is Wrong!</b></font>"; die;}
if(!filter_var($imei, FILTER_VALIDATE_EMAIL)){
if(strlen($imei) < "11" || strlen($imei) > "15"){echo "<font color=\"red\"><b>IMEI or SN is Wrong!</b></font>"; die;}}

$curl = curl_init ("https://sickw.com/api.php?format=$format&key=$api&imei=$imei&service=$service");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
$result = curl_exec($curl);
curl_close($curl);

echo PHP_EOL."<br/><br/>".PHP_EOL.$result; // Here the result is printed
}
?>

@endsection

0 likes
3 replies
keroherox10's avatar

@Snapey

okay when i remove it and open page so when i testing and click on button submit i get this

The POST method is not supported for this route. Supported methods: GET, HEAD.

tykus's avatar

@keroherox10 first time using Laravel???

Your view is at the end of a GET route that you defined I suppose, e.g.

Route::get('your-url',  // ....

But you are submitting a POST request to the same URL (because the action is empty) and Laravel does not know how to handle a POST request to that URL (you have not registered such a route).

You could but definitely should not replace the get method with any or match so Laravel can handle a POST request to the same endpoint

https://laravel.com/docs/8.x/routing#available-router-methods

Route::any('your-url',  // ....
// or
Route::match(['GET', 'POST'], 'your-url', //...

AGAIN DO NOT DO THIS

Instead, you should define a Route to handle that POST request (even if it has the same URL). You can move all of the form-processing logic in to this Route Closure/Controller action. Instead of the $_POST superglobal; use the Request class to get form data from the Request

Route::get('your-url', //...); // returns the view
Route::post('your-url', function (\Illuminate\Http\Request $request) {
    $format = "html";
    $imei = $request->input('imei');
    // etc etc
});

Don't forget to add a CSRF token to your form

1 like

Please or to participate in this conversation.