So the below is a snippet of some code of mine.
<?php
if (!empty($_POST['name']) && !empty($_POST['blocks'])) {
$name = mysql_real_escape_string($_POST['name']);
$blocks = mysql_real_escape_string($_POST['blocks']);
$registerQuery = mysql_query("INSERT INTO events (Name, Blocks) VALUES('".$name."', '".$blocks."')");
if ($registerQuery) {
echo "<script> window.location.replace('/manager/index?success=addEvent')</script>";
} else {
echo "<script> window.location.replace('/manager/index?failure=addEvent')</script>";
}
} else {
?>
<!-- CONTENT CONTAINER -->
<div class="container">
<form method="post" action="/manager/addEvent.php" name="registerform" id="registerform">
<div class="form-group">
<label for="name">Event Name</label>
<input type="text" class="form-controll" id="name" placeholder="e.g. artblocks">
</div>
<div class="form-group" name="blocks" id="blocks">
<select class="form-control" for="blocks">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">5</option>
<option value="">6</option>
<option value="">7</option>
<option value="">8</option>
</select>
</div>
<div class="form-group">
<input type="submit" name="register" id="register" class="btn btn-default" value="Submit" />
</div>
</form>
<?php } ?>
When I submit the form on my webpage, it doesn't work at all. It just refreshes the page as if nothing had happened. When I try to use the "BACK" arrow, google chrome warns me that I have submitted information and I'll have to resubmit it. I know it's "submitting", but it's not tossing me back to the main page at all. I have JQuery, and I know that none of the files end with .php that are being referenced, my .htaccess is set up for that. I cannot for the life of me figure out what's wrong here.
mysql_*functions. They are no longer maintained and are officially deprecated. Learn about prepared statements instead, and use PDO. In additiona add some error checking to your queries and PHP.<input type="text" class="form-controll" id="name" placeholder="e.g. artblocks">/<select class="form-control" for="blocks">I don't want to start the entire conversion process yet, as this is going off to the live server soon.worries me. You should be addressing deprecated and security issues before it goes to a live server, not after.<?phptagerror_reporting(E_ALL); ini_set('display_errors', 1);