Jump to content

Recommended Posts

Hi,

 

got a little problem.

 

There is a 3 table:

 

I want to list all the product groups but to be checked in checkbox only what choose the user.

 

If from outside (choos.php?tt_reg_id=1) user is nr 1 then in listed checkboxes need to be checked only those checkboxes what the user nr 1 choose / but listed the all product groups.

 

 

<form method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<?php
/* There is 3 tables
1. table of PRODUCT GROUPS => tt_product_group
2. table of CHOOSSING => tt_reg_choice
and te 3. table is the table of USERS => tt_reg
*/

include "../mysql_connect.php";
error_reporting(E_ERROR);
@ini_set('display_errors', '1');

$query_product_group_check = mysql_query("Select
tt_product_group.tt_product_group_id,
tt_product_group.tt_product_group_sr,
tt_reg_choice.tt_reg_choice_id,
tt_reg_choice.tt_reg_choice_reg,
tt_reg_choice.tt_reg_choice_check,
tt_reg.tt_reg_id,
tt_reg.tt_reg_firm
From
tt_product_group
,
tt_reg_choice
Inner Join tt_reg ON tt_reg.tt_reg_id = tt_reg_choice.tt_reg_choice_reg
");

		if(!$query_product_group_check) {
			echo mysql_error();
			exit;
		}

		while($request = mysql_fetch_array($query_product_group_check)) {

		if(isset($request['tt_reg_choice_check'])) {
			$checked_ornot = "checked";
		} else {
			$checked_ornot = "";
		}
?>
<input type="checkbox" name="tt_reg_choice_check[<?php print $request['tt_product_group_id'];?>]" value="<?php print $request['tt_product_group_id'];?>" <?php print $checked_ornot;?>><?php print $request['tt_product_group_sr'];?>
<input type="hidden" name="tt_reg_id" value="<?php $_REQUEST['tt_reg_id'];?>">
<?php }?>
<form>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.