I’m currently trying to get users to submit data via PHP/HTML forms and into a SQL database. I can do this happily but would like to not allow users to input the Index column as it is automatically incrementing ajd wouldn’t want to be fiddled with.
The current code I have is like this:
$result = mysql_query("SELECT * FROM {$table}") or die(mysql_error());
// Start a form to run insert.php
echo "<form action=\"insert.php\" method=\"post\">";
// Loop to create boxes in the form
for ($i = 0; $i < $fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "{$field->name}: <br /><input type=\"text\" name=\"{$field->name}\"onkeypress=\"return noenter()\"/>";
echo "<br />";
};
// End form.
echo "<input type=\"submit\">
</form>
</div>";
From here how could I ignore the Index column. I have total access to the database if that helps.
Thanks guys, in advance!
If you don’t want this field to be displayed, just add a precondition in your loop before generating the output, something like this: