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

I'm really new to this myself, but should

($industry = "Coal and Power")

be

($industry == "Coal and Power")

?

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.