?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?radio buttons and mysql results
Author:??(---.cas-gue.golden.net)
Date:???03-23-03 08:07

i have a table called tasks structured like so:

task_id - auto_increment primary key
task_description
status - either 0 (incomplete) or 1 (complete)

i can display the results that are in the databsae fine with this:

$query = "select * from task_list";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

echo "
";

echo "";
echo "";
echo "";
echo "";
echo "";
echo "";

for ($i=0; $i<$num_results; $i++) {
$row = mysql_fetch_array($result);
$task_id = $row['task_id'];
$task_description = $row['task_description'];
$status = $row['status'];

echo "\n\n\n";
echo "\n";

echo "\t\n";

echo "\t\n\n";

}

echo "
Task IdDescriptionIncompleteComplete
?
$task_id$task_description
if ($status == 0) {
echo "checked>";
}

echo "

if ($status == 1) {
echo "checked>";
}

echo "
";

but im not sure how to update the values in the database when the user selects different radio button values.

how do i tell php which value corresponds to which task_id. it would be easy if i could just roll down the for loop using the i as a counter...but some tasks will be deleted by users so the auto_increment task_id will change.

i really appreciate any help on this...im pretty stumped

thanks :)

?Topics Author? Date
?radio buttons and mysql results??new
evan 03-23-03 08:07?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > i have a table called tasks structured like so: > > task_id - auto_increment primary key > task_description > status - either 0 (incomplete) or 1 (complete) > > i can display the results that are in the databsae fine with > this: > > $query = "select * from task_list"; > $result = mysql_query($query); > $num_results = mysql_num_rows($result); > > echo "
"; > > echo ""; > echo ""; > echo ""; > echo ""; > echo ""; > echo ""; > > for ($i=0; $i<$num_results; $i++) { > $row = mysql_fetch_array($result); > $task_id = $row['task_id']; > $task_description = $row['task_description']; > $status = $row['status']; > > echo "\n\n\n"; > echo "\n"; > > echo "\t\n"; > > echo "\t\n\n"; > > } > > echo "
Task IdDescriptionIncompleteComplete
 
$task_id$task_description value='0'"; > > if ($status == 0) { > echo "checked>"; > } > > echo " value='1'"; > > if ($status == 1) { > echo "checked>"; > } > > echo "
"; > > but im not sure how to update the values in the database when > the user selects different radio button values. > > how do i tell php which value corresponds to which task_id. > it would be easy if i could just roll down the for loop using > the i as a counter...but some tasks will be deleted by users > so the auto_increment task_id will change. > > i really appreciate any help on this...im pretty stumped > > thanks :) ">??

Provided By
Phorum