0

So I have a script that is processing results of a form. What I'm trying to do is to set a variable by the results of a dropdown. This variable is a filename.

Here is the PHP that processes it:

if ($industry = "Coal and Power") {$link = "Coal-and-Power-portfolio.pdf";}	
elseif ($industry == "Composting") {$link = "Composting-portfolio.pdf";}	
elseif ($industry == "Concrete and Aggregate") {$link = "Concrete-and-Aggregate-portfolio.pdf";}	
elseif ($industry == "Construction") {$link = "Construction-portfolio.pdf";}	
elseif ($industry == "Demolition") {$link = "Demolition-portfolio.pdf";}	
elseif ($industry == "Landfill") {$link = "Landfill-portfolio.pdf";}	
elseif ($industry == "Mining") {$link = "Mining-portfolio.pdf";}	
elseif ($industry == "Recycling and Scrap") {$link = "Recycling-and-Scrap-portfolio.pdf";}	
elseif ($industry == "Steel and Slag") {$link = "Steel-and-Slag-portfolio.pdf";}	
elseif ($industry == "Waste Transfer") {$link = "Waste-Transfer-portfolio.pdf";}	
elseif ($industry == "Wood Processing") {$link = "Wood-Processing-portfolio.pdf";}	
elseif ($industry == "Other") {$link = "Other-response-portfolio.pdf";}

The problem is that when the script runs it always sets the variable to the first value in the first IF statement.

Does anyone see what I am doing wrong?

Thanks,

James

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by RGStrat
0

I'm really new to this myself, but should

($industry = "Coal and Power")

be

($industry == "Coal and Power")

?

0

Oh wow....it was that. I spent like 30 minutes trying to figure out what I did. Just goes to show the importance of proof-reading!

Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.