Hi,
I want to create a dynamic form, relative with the table i'm working with.
I'm selecting the columns from a certain table:
<?php
$tableColumns = $dbConnect->query("SHOW COLUMNS
FROM projects
WHERE Field NOT IN ('ID');");
?>
Then i want to get each result's value (according to the ID selected) and put it in an array:
URL: localhost/index.php?page=form&action=update&id=1
<?php
$values[]="";
if($_GET['action']=='update')
{
$selectTableResult=$dbConnect->query("SELECT *
FROM ".$table."
WHERE `ID`=1");
while($rowTable=$selectTableResult->fetch_assoc())
{
print_r($values[] = $rowTable);
}
}
?>
What i want to do is write something like this:
<div class="form-group">
<label>Text Input</label>
<input class="form-control" name="textBox" type="text" value="<?php echo $value[1] ?>">
</div>
Like this, if i want to update an Item, the value of the input is "Test" (or whatever) and if i want to add an Item the value is empty.
Can someone help me, please?
Thanks!