Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1.                         <?php
  2.                             $Vehicle = 1;
  3.                             if (($handle = fopen("DATA.csv", "r")) !== FALSE) {
  4.                                 while (($Vehicle_Information = fgetcsv($handle, 1000, ",")) !== FALSE) {
  5.                                 $num = count($Vehicle_Information);
  6.  
  7.                             // establishing common variables based on input from CSV
  8.                             $stock =      $Vehicle_Information[0];
  9.                             $year =       $Vehicle_Information[1];
  10.                             $make =       $Vehicle_Information[2];
  11.                             $model =      $Vehicle_Information[3];
  12.                             $VIN =        $Vehicle_Information[4];
  13.                             $miles =      $Vehicle_Information[5];
  14.                             $color =      $Vehicle_Information[6];
  15.                             $features =   $Vehicle_Information[7];
  16.                             $VPrice =     $Vehicle_Information[8];
  17.                             $WPrice =     $Vehicle_Information[9];
  18.                             $IPrice =     $Vehicle_Information[10];
  19.                             $DOL =        $Vehicle_Information[11];
  20.                             $Location =   $Vehicle_Information[12];
  21.                             $DealerCost = $Vehicle_Information[13];
  22.                             $engine =     $Vehicle_Information[14];
  23.                             $trans =      $Vehicle_Information[15];
  24.  
  25.                             //Create an array containing Vehicle Information
  26.                             $test = array($stock, $year, $make, $model, $VIN, $miles, $color, $features, $VPrice, $WPrice, $IPrice, $DOL, $Location, $DealerCost, $engine, $trans);
  27.                             //Encode the array to prepare for travel to other pages
  28.                             $encode = rawurlencode(serialize($test));
  29.  
  30.  
  31.                             //Import the CSS
  32.                             echo '<link rel="stylesheet" type="text/css" href="style.css" />';
  33.  
  34.  
  35.                             // format for the table
  36.                             echo "<ul class=Vlist ><a href=page2Test.php?testvar=".$encode. "\">";
  37.  
  38.                             echo "<li class=Vlist>$Vehicle_Information[0] - $Vehicle_Information[1]  - $Vehicle_Information[2]  $Vehicle_Information[3] - $Vehicle_Information[4]</li>";
  39.                             echo "</a>";
  40.                             echo "</ul>";
  41.         $Vehicle++;
  42.         for ($i=0; $i < $num; $i++) {
  43.             $Vehicle_Information[$i] . "<br />\n";
  44.         }
  45.        
  46.     }
  47.     fclose($handle);
  48. }
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement