How do I get an if statement nested in a while statement to work?

I want to run a while loop which contains a nested if statement. When I click submit in my html document, I expect to receive the value of $ex, but instead the page freezes.

I have tested my variables and each works. I have also ran a while loop and if statement independently to ensure they are working. Lastly, I have searched related questions for over an hour and have not find any question pertinent to my situation.

Here is my html.


<form method="post" action="baseNum.php">

Enter a number you wish to convert
<input type="text" name="number">
<select name="baseChoice">
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
<input type="submit" name="Submit">



Here is my php.


$base = htmlspecialchars($_POST['number']);
$baseNum = htmlspecialchars($_POST['baseChoice']);
$baseEx = 0;
$ex = 0;
$boo = True;

while ($boo == True) {
  $baseNum ** $ex = $baseEx;
  if ($baseEx <= $base) {
    $ex = $ex + 1;
  } else {
    $boo = False;

echo $ex;