View Single Post
  #9 (permalink)  
Old 07-16-04, 01:54 PM
fccolon fccolon is offline
Newbie Coder
 
Join Date: Mar 2004
Location: West Mids. UK
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
founds how yoy import the code now

PHP Code:



<?php

$conn 
mysql_connect("server""user""pwd");
  
mysql_select_db("leaguedb"$conn);

if (
$_POST[op1] != "select1")

 {

  
$get_list "select id, div_name from GPL_division";
  
$get_list_res mysql_query($get_list) or die(mysql_error());

  
$display_block "<h1>Add Driver to Division</h1>";

  
$display_block .= "
       <form method=\"post\" action=\"
$_SERVER[PHP_SELF]\">
       <p><strong> Select Division:</strong><br>
       <select name=\"sel_divid\">
       <option value=\"\">-- Go on, pick your division --</option>"
;

       while (
$divrecs mysql_fetch_array($get_list_res))
         {
          
$id $divrecs[id];
          
$div_name stripslashes($divrecs[div_name]);
          
$display_block .= "
          <option value=\"
$id\">$div_name</option>";
         }

   
$display_block .= "
   </select>
   <input type=\"hidden\" name=\"op1\" value=\"select1\">
   <p><INPUT type=\"submit\" value=\"Select\"></p>

   </form>"
;


   
$divid $sel_divid;
  }

elseif (
$_POST[op2] != "select2")

 {

echo 
$sel_divid;

  
$get_list "select id, driver_name from GPL_drivers";
  
$get_list_res mysql_query($get_list) or die(mysql_error());

  
$display_block "<h1>Add Driver to Division</h1>";
  
$display_block .= "
       <form method=\"post\" action=\"
$_SERVER[PHP_SELF]\">
       <p><strong> Select Drivers:</strong><br>
       <select name=\"sel_drvid[]\" multiple>
       <option value=\"\">-- Go on, pick your drivers --</option>"
;

       while (
$drvrecs mysql_fetch_array($get_list_res))
         {
          
$id $drvrecs[id];
          
$driver_name stripslashes($drvrecs[driver_name]);
          
$display_block .= "
          <option value=\"
$id\">$driver_name</option>";
         }

        
$display_block .= "
        </select>
        <input type=\"hidden\" name=\"op2\" value=\"select2\">
        <p><INPUT type=\"submit\" value=\"Select\"></p>

   </form>"
;
 echo 
$sel_divid;
  }

if (
$_POST[op2]= "select2")

  {

    
$selects sizeof($sel_drvid);

    
$i0;
echo 
$sel_divid;

    while (
$i $selects)
      { 
         
$did $sel_drvid[$i];
 echo 
$i;
         
$i++;
         
$make_link "INSERT INTO GPL_lsdd VALUES ('', '$sel_divid', '$did' )";
         
$make_link_res mysql_query($make_link) or die(mysql_error());

       
      }
  }
  
 
?>

<html>
<head>
<title>Add Drivers to Division</title>
</head>
<body>
<?php echo $display_block?>
</body>
</html>
Reply With Quote