Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-03-2006, 06:18 PM   PM User | #1
alex57
Regular Coder

 
Join Date: Sep 2006
Posts: 216
Thanks: 9
Thanked 0 Times in 0 Posts
alex57 has a little shameless behaviour in the past
php checkboxes forms

Hello,

I have a page which reads records from MySQL database into an html written form. Besdie each record there is a checkbox. Ideally I would like for a user to check the checkbox beside a record, click submit, and the on the next page display the record again so it can be updated.

However, I am not sure what hitting submit actually takes from the first page to the next. The code I have is below:

PHP Code:
<?php

mysql_connect
("localhost""root""dinosaur") or die(mysql_error());
mysql_select_db("info") or die(mysql_error());

$query "SELECT fname, sname, teamname, username, priv FROM users"$result mysql_query($query) or die(mysql_error());

echo 
"<form name=myForm action='Edit.php' method='post'><table border=1 class='table'><tr><td>First Name</td><td>Second Name</td><td>Team Name</td><td>Username</td><td>Privilege</td><td>Edit</td></tr>";

while(
$row mysql_fetch_array($result)){

    echo 
"<tr><td>" $row['fname']. "</td><td>" $row['sname'] . "</td><td>" $row['teamname'] . "</td><td>" 
$row['username'] . "</td><td>" $row['priv'] . "</td><td><input type='checkbox' name='" 
$row['userID'] . "></td></tr>";
    
}
echo 
"<tr><td colspan=3 align=center><input type='submit' value='Confirm'></form></td><td colspan=3 align=center></td</tr></table>";
?>
Each checkbox should be named with the unique number of the record each time the next one is displayed. From here how would i display the corresponding record on another page?? How does the next page know which checkbox has been checked? what is taken across to this next page ?? I dont understand !!!!!!!

Thanks
alex57 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:25 AM.


Advertisement
Log in to turn off these ads.