Updating a PHP variable through HTML

admin

Administrator
Staff member
I want to be able to change the PHP variables
Code:
$dispname
and
Code:
$banstat
in the code below with a HTML form.

Code:
<?php
if (isset($_GET['p']) && $_GET['p'] == "login") {
$servername = "localhost";
$username = "foo";
$password = "bar";
$dbname = "wordpress";
$banstat = '1';
$dispname = "Brendan";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} 

$sql = "UPDATE wp_oxygenpurchaseusers SET user_url=$banstat WHERE    display_name=$dispname";

if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}

$conn->close();
}
?>

</script>
<link href="http://jotform.us/static/formCss.css?3.3.8019" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="http://jotform.us/css/styles/nova.css?3.3.8019" />
<link type="text/css" media="print" rel="stylesheet" href="http://jotform.us/css/printForm.css?3.3.8019" />
<style type="text/css">
.form-label-left{
    width:150px !important;
}
.form-line{
    padding-top:12px;
    padding-bottom:12px;
}
.form-label-right{
    width:150px !important;
}
.form-all{
    width:650px;
    color:#555 !important;
    font-family:"Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, sans-serif;
    font-size:14px;
}
</style>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>?p=login" method="post">
<input type="hidden" name="formID" value="51970718174158" />
<div class="form-all">
<ul class="form-section page-section">
  <li id="cid_4" class="form-input-wide" data-type="control_head">
    <div class="form-header-group">
      <div class="header-text httal htvam">
        <h2 id="header_4" class="form-header">
          Ban Tool
        </h2>
      </div>
    </div>
  </li>
<form action="<?php echo $_SERVER['PHP_SELF'];  ?> method="post">
Name: <input type="text" name="dispname"><br>
E-mail: <input type="text" name="banstat"><br>
<input type="submit">
</form>
  <li style="display:none">
    Should be Empty:
    <input type="text" name="website" value="" />
  </li>
</ul>
</div>
<input type="hidden" id="simple_spc" name="simple_spc" value="51970718174158" />
<script type="text/javascript">
document.getElementById("si" + "mple" + "_spc").value = "51970718174158-51970718174158";