how to display data from database?

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
hi guys..!! i'm actually having a form for user to register their daily task. once they register, the data will be saved in the database. each task has its own status whether finish or pending. i want the user to change/edit the status for each task easily by viewing back all the information they entered before in the form like register form. can anybody show me any simple example to get the form with the data back? :help:
 
Example:
Code:
<?php

$sql = mysql_query("SELECT name, email, job FROM persons WHERE active = 1");

print '<form name="f" action="whatever" method="post">' . "\n";

$y = mysql_num_fields($sql);
while($row = mysql_fetch_array($sql)) {
   for ($x=0; $x<=$y; $x++) {
      $fieldname = mysql_field_name($sql, $x);
      print '<input name="' . $fieldname . '" value="' . $row[$fieldname] . '" type="text" />' . "\n";
   }
}

print '<input name="submit" type="submit" value="Update" />' . "\n";
print '</form>' . "\n";
Something like that!
 
i'm sorry..i do not really understand that. in the registration form, there are 5 textbox. how i can get the whole form so that i can edit all the data entered before?
 
to GET the information from the form you shall use $_POST[] var array if you are using post mething and $_GET[] var array if yoiu are using get method
more information on http://www.php.net superglobals section
 
fixaded said:
...can anybody show me any simple example to get the form with the data back...
Sorry fixaded, i think i misunderstood. Alexei gave you the answer.
 
Back
Top