I have a hidden input within a form. When I submit the form, I want to create a new column in a table named "answers" with a title based on the value of the hidden input.
CODE FOR FORM + HIDDEN INPUT
<form action="frameworkplayground.php" method="POST">
<input type="hidden" name="LevelColumnAdder" value="Simplifying Fractions">
<input type="submit" id="samplesubmitbutton" value="Click Me">
</form>
CODE TO TAKE THE VALUE OF THE HIDDEN INPUT (NAMED "LevelColumnAdder") ADD THE WORD "Test" TO THE VALUE & USE THIS AS THE TITLE OF A NEW COLUMN.
<?php
if(isset($_POST['LevelColumnAdder'])){
$LevelColumnAdder=$_POST['LevelColumnAdder']; //Here, I'm trying to get the value of the input named LevelColumnAdder
$db->query("ALTER TABLE answers ADD $LevelColumnAdder+"Test" VARCHAR( 255 ) NOT NULL"); //I know the +"Test" part is wrong but I don't know how to add "Test" to the value and use it as the new title
}
?>
When this form is submitted, I ultimately want it to form a new column named "Simplifying Fractions Test" but nothing is happening.