Each user has a long list of magazines to choose from. Problem is that for
every magazine there is a checkbox and there are a lot of magazines to
choose from (more than 100). I put all of them in one form. After submit I
have to know which magazines user checked.
Is there any more simple way than mine? Well here it is:

I got a form with checkboxes which names are primary keys of every magazine.
I use "sif_" in front because you cannot have variables like $123 =>
$sif_123.

<input type="checkbox" name="sif_<? echo $wponud[6]; ?>" value="1">

After submitting the form I have to know which magazines user ordered. I go
through user's magazines again and use eval function twice to get variable
submited by form.

<?
  while ($wponud =  mysql_fetch_array($izpis_raw)) {
      $temp = "sif_$wponud[6]";
      eval ("\$temp = \"$temp\";");
      $temp = "$".$temp;
      eval ("\$temp = \"$temp\";");
      if ($temp == 1) {
        // got it
        echo $wponud[6]."<br>";
      }
?>

If anybody can think of better way to do it, please let me know.

tnx.

mitja.

Reply via email to