Creating a register
Id like to create a manual register system but am not sure how to do parts of this.. I would like to list all the names of the people in my database (tblGroup) along with a textbox next to the name. When the user clicks submit, it will add all the people with a tick in the tickbox into the DB (tblRegister)
Im only really stuck on the tickbox part...
You would do this like any checkbox but you would assign a name with  following it. For example, instead of giving each person's checkbox a separate name, you'd call all the checkboxes the same: userchkbox.
The result will be that in your action page, all the ones that have been clicked will be available to you under $_POST['userchkbox'], which will be an array over which you can loop and, one by one, insert in tblRegister.
Erm..Not really, i havent really done anything with arrays or such before... Can you explain a little more?
In your form or form part of you script, introduce something like this to retrieve the user names from the table:
When you're ready to process the form, you would retrieve the checked user names as follows:
$sql = "SELECT * FROM tblGroup ORDER BY user_name ASC";
$qry = mysql_query($sql) or die("SQL Error: $sql<br>" . mysql_error());
WHILE ($r = mysql_query($qry)) :
echo "<input type='checkbox' name='frm_user_name' value='" . $r['user_name'] . "'>" . $r['user_name'] . "<br>";
//rest of form...
Something to consider: If you're going to store a list of users, you should store their user ID rather than user name as above.
$arrUserList = $_POST['frm_user_name'];
FOREACH ($arrUserList as $key => $thisUSER) :
echo "or whatever you want to do with " . $thisUSER . "<br>";
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)