Jump to content

MHatrak

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About MHatrak

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I don't think I am explaining it right, I just want to take the url http://domain.com/index.php?category=bedroom and replace $sofa with $bedroom and have the $bedroom pull the correct url. I think a print or echo is correct not sure? If it helps here is what the included php file contains <?php $sofa = "http://pathtospreadsheet.com"; $bedroom = "http://pathtospreadsheet.com"; $dining = "http://pathtospreadsheet.com"; ?> ignore $myarray was attempting to use to make work as it gets the value from text file. The value is a plain url. how do you change this code <?PHP function readCSV($csvFile){ $file_handle = fopen($csvFile, 'r'); while (!feof($file_handle) ) { $line_of_text[] = fgetcsv($file_handle, 1024); } fclose($file_handle); return $line_of_text; } $csvFile = "$sofas"; $csv = readCSV($csvFile); //print_r($csv); ?> to this just using value in the url <?PHP function readCSV($csvFile){ $file_handle = fopen($csvFile, 'r'); while (!feof($file_handle) ) { $line_of_text[] = fgetcsv($file_handle, 1024); } fclose($file_handle); return $line_of_text; } $csvFile = "$bedroom"; $csv = readCSV($csvFile); //print_r($csv); ?>
  2. Yes, the included file is a text file. That part works fine, I am trying to change $csv = readCSV ($sofas); value using url ie. http://domain.com/index.php?category=bedroom and have that change value of $csv = readCSV ($bedroom);
  3. I have a .txt file, that I include in my php file. The line that has $sofas = "the url to my spreadsheet"; I would like to change the $csvFile = "$path"; dynamically using the url. http://domain.com/furniture.php?category=sofas and have the below code to update the line $csvFile = "$path"; and use the sofas url value instead. This is my first time using php so any help would be appreciated. <?PHP if (isset($_GET['category'])) { $category = $_GET['category']; } $category = (isset($category)) ? $category : ''; $path = "$myarray[0] $category"; ?> <?PHP function readCSV($csvFile){ $file_handle = fopen($csvFile, 'r'); while (!feof($file_handle) ) { $line_of_text[] = fgetcsv($file_handle, 1024); } fclose($file_handle); return $line_of_text; } $csvFile = "$path"; $csv = readCSV($csvFile); //print_r($csv); ?>
×
×
  • 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.