Advertisement
Guest User

Untitled

a guest
Apr 13th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.41 KB | None | 0 0
  1. print "<table cellpadding='1' cellspacing='3' bgcolor='#FFFFFF'>";
  2.  
  3. // show row of parameter names
  4. $query="SELECT * FROM ce_parameters ORDER BY ceparam_position ASC";
  5. $result=mysql_query($query) or die("Query failed : " . mysql_error());
  6. print "\n<tr><th>Product Name</th>";
  7. $colcolors = array();
  8. $paracolnum = 0;
  9. while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
  10. {
  11.     $ceparam_id             = $line['ceparam_id'];
  12.     $ceparam_name           = stripslashes($line['ceparam_name']);
  13.     $ceparam_description    = stripslashes($line['ceparam_description']);
  14.     $ceparam_required       = $line['ceparam_required'];
  15.     $ceparam_color          = $line['ceparam_color'];
  16.  
  17.     $colcolors[$paracolnum] = $ceparam_color;
  18.     print "\n<th bgcolor='".$colcolors[$paracolnum]."'><span title='".$ceparam_description."'>".$ceparam_name."</span></th>";
  19.     $paracolnum++;
  20. }
  21. print "\n</tr>";
  22.  
  23. print "<form method='post' action='intranet_product_matrix.php'>";
  24. // show list of products along data
  25. $query="SELECT * FROM ce_products ORDER BY ceprod_name ASC"; //select all from products table
  26. $result=mysql_query($query) or die("Query failed : " . mysql_error()); //get results of query
  27. while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) //loop through results
  28. {
  29.     //set variables
  30.     $ceprod_id      =$line['ceprod_id'];
  31.     $ceprod_name    =stripslashes($line['ceprod_name']);
  32.     $ceprod_intranet_url=$line['ceprod_intranet_url'];
  33.    
  34.     print "\n<tr>";
  35.     print "\n<td width='100'><a href=\"".$ceprod_intranet_url."\">".$ceprod_name."</a></td>";
  36.     $query2="SELECT * FROM ce_parameters ORDER BY ceparam_position ASC"; //select all from parameters table
  37.     $result2=mysql_query($query2) or die("Query failed : " . mysql_error()); //get results 
  38.     $numcol = 0; //initialise column index
  39.     while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) //loop through results of parameters array
  40.     {
  41.         $ceparam_type = $line2['ceparam_type'];
  42.         $ceparam_id = $line2['ceparam_id'];
  43.         print "\n<td bgcolor='".$colcolors[$numcol]."' width='50'>";
  44.         if ($ceparam_type == "text")
  45.         {
  46.             print "<input type='text' name='prod_matrix[".$ceprod_id."][".$ceparam_id."]'><br>";
  47.             if (isset($_POST['cmd']))
  48.             {
  49.                 $cmd = $_POST['cmd'];
  50.                 if ($cmd == "editurl")
  51.                 {
  52.                     print "<br><input type='text' size='1' placeholder='url'>";
  53.                 }
  54.             }
  55.             else
  56.             {
  57.                 print "<a href='LINK TO INTRANET PAGE HERE' style='text-decoration: none'>x</a>";
  58.             }
  59.         }
  60.         else if ($ceparam_type == "checkbox")
  61.         {
  62.             print "<input type='checkbox'>";
  63.             if (isset($_POST['cmd']))
  64.             {
  65.                 $cmd = $_POST['cmd'];
  66.                 if ($cmd == "editurl")
  67.                 {
  68.                     print "<br><input type='text' size='1' placeholder='url'>";
  69.                 }
  70.             }
  71.             else
  72.             {
  73.                 print "<a href='LINK TO INTRANET PAGE HERE' style='text-decoration: none'>x</a>";
  74.             }
  75.         }
  76.         print "</td>";
  77.         $numcol++;
  78.     }
  79.  
  80.     print "\n</tr>";
  81. }
  82.  
  83. print "\n</table>";
  84. if (isset($_POST['cmd']) && ($_POST['cmd'] == "editurl"))
  85. {
  86.     print "<input type='hidden' name='cmd' value ='addmatrixurl'>";
  87.     print "<input type='submit' value='Submit URL Changes'>";
  88.     print "</form>";
  89. }
  90. else
  91. {
  92.     print "<input type='hidden' name='cmd' value='addmatrix'>";
  93.     print "<input type='submit' value='Submit Changes'>";
  94.     print "</form>";
  95. }
  96.  
  97. if (!(isset($_POST['cmd']) && ($_POST['cmd'] == "editurl")))
  98. {
  99.     print "<form method='post' action='intranet_product_matrix.php'>";
  100.     print "<input type='submit' value='Edit URLS'>";
  101.     print "<input type='hidden' name='cmd' value='editurl'>";
  102.     print "</form>";
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement