There seems to be a problem with this script. Whenever I change the value of $i to like 2 or something it outputs A field not ALL fields. I am not sure what is wrong.
Additionally is it possible to do something like this? Basically there are more fields in the result query, but I only want to output the values of the fields listed in the result query that I want the user to be able to edit (displayed in resultInput)
<?php
require('dbc.php');
mysql_select_db($db);
$result = mysql_query("SELECT * FROM about WHERE id=1");
$resultInput = array('page_header', 'sub_header', 'content', 'content_short');
if (mysql_num_rows($result) > 0) {
//loop creates inputs
//make $resultInput object to array.
$i=0;
while ($row = mysql_fetch_assoc($result)) {
$meta = mysql_fetch_field($result, $i);
if(in_array($meta->name, $resultInput )){
echo '<div class="wrapper"><label>' . ucfirst(str_replace('_', ' ',$meta->name)) .
'<br><input name="' . $meta->name .
'" type="text" class="input" value="'.$row[$meta->name].'"><br></label></div>';
}
$i++;
}
}
?>
While this isnt how I would do it.. ive taken your code and made it so it should work..
FYI
Heres how I would have done it, although looking at it, Im not happy with the echo.. but..