I'm trying to update some variables in my PHP file, but they are not being updated.
Here is the PHP code:
<?php
require 'mojang-api.class.php';
if (isset($_GET["search"])) {
$searchQuery = $_GET["search"];
if (isset($_GET["selectOption"]) == "1") {
if (strlen($searchQuery)>16) {
//UUID
$username = MojangAPI::getUsername($searchQuery);
$uuid = MojangAPI::getUuid($username);
}
else {
//USERNAME
$uuid = MojangAPI::getUuid($searchQuery);
$username = MojangAPI::getUsername($uuid);
}
}
Here is the HTML I am trying to edit:
<header>
<div class="container text-center">
<h2>Scam report for <?php echo $username; ?></h2>
<div class="text-center">
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div style="color: white" class="panel-heading"><?php echo $username; ?></div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-md-9">
<div class="panel panel-default">
<div style="color: white" class="panel-heading">Information</div>
<table style="color: #333; text-align: left" class="table">
<tr>
<td style="min-width: 100px;" >UUID</td>
<td><?php echo $uuid; ?></td>
</tr>
These snippets are just part of my full document. I have got all the closing brakcets and closing tags. The file extension is .PHP and I am running a web server using XAMPP through Dreamweaver CC 2017.
The PHP code is placed just after the opening of the BODY tag, and the html is lower down in the document
I think the problem is something to do with me assigning the variables in the IF statements, and them not getting updated in the main HTML code, but I'm not sure.
The errors I get are:
Notice: Undefined variable: username in C:\xampp\htdocs\website\search.php on line 88
Notice: Undefined variable: uuid in C:\xampp\htdocs\website\search.php on line 100
NOTICE: UNDEFINED VARIABLE: USERNAME IN C:\XAMPP\HTDOCS\WEBSITE\SEARCH.PHP ON LINE 82
Any help would be greatly appreciated!