... use table fieldnames as form field names?
I'm creating SQL statements dynamically.
E..g. I have a form where the form field names has the same name as the table fields.
<form name="updateOrganization" action="update.php" method="post">
<input name="orgID" />
<input name="orgName" />
</form>
Table Organization has orgID and orgName as fields.
Now in update.php I have
$query =' UPDATE organization SET ';
foreach($_POST as $key => $value)
{
if ($value)
{ $query.= $key.' = "'.$value.'",'; }
else
{ $query.= $key.' = NULL,'; }
}
$query = substr($query, 0,-1);
$query.=' WHERE orgID = "'.$_orgID.'"';
Is it "safe" to display the table names in the HTML file?