Jump to content

Problem with get variable and fopen


flattened

Recommended Posts

I'm trying to make a plugboard (success) that allows the input of common button sizes (88x31, 100x35, 468x60 [success]) and displays them based on the get variable (FAIL). But my problem is, it's not following the GET, it just prints everything:

$myFile is the file (that part works fine)

 
if($_GET[ads]="small"){
$file_handle = fopen($myFile, "rb");
	while (!feof($file_handle) ) {
		$line_of_text = fgets($file_handle);
		$parts = explode('|', $line_of_text);	
		if($parts[4] == "0" && $parts[0]== 31){
			$alt= $parts[2];
			if($parts[2]==""){$alt=$parts[3];}
			echo " <a href=\"".$parts[3]."\"><img src=\"".$parts[1]."\" alt=\"".$alt."\" target=\"_blank\"></a>";
		}
	}
}
if($_GET[ads]="medium"){
$file_handle = fopen($myFile, "rb");
	while (!feof($file_handle) ) {
		$line_of_text = fgets($file_handle);
		$parts = explode('|', $line_of_text);	
		if($parts[4] == "0" && $parts[0]== 35){
			$alt= $parts[2];
			if($parts[2]==""){$alt=$parts[3];}
			echo "<a href=\"".$parts[3]."\"><img src=\"".$parts[1]."\" alt=\"".$alt."\" target=\"_blank\"></a>";
		}
	}
}
if($_GET[ads]="large"){
$file_handle = fopen($myFile, "rb");
	while (!feof($file_handle) ) {
		$line_of_text = fgets($file_handle);
		$parts = explode('|', $line_of_text);	
		if($parts[4] == "0" && $parts[0]== 35){
			$alt= $parts[2];
			if($parts[2]==""){$alt=$parts[3];}
			echo "<a href=\"".$parts[3]."\"><img src=\"".$parts[1]."\" alt=\"".$alt."\" target=\"_blank\"></a>";
		}
	}
}

 

Does anyone see why this would not work?  :shrug: Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/180475-problem-with-get-variable-and-fopen/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.