Below is a script I am writing, what it does it take in values from webpage and basically just write them to a file. What I am trying to do is: there is heap of different sections on the page, hessian, linen and more to be added. I want the script to ONLY write to file the section that is selected and leave the rest out. I think maybe I have done something wrong with the ifs as it writes every field to the file when I have specified no values so the file should be blank. Any help greatly appreciated.
Ridgey File values being written even though nothing has been specified on the webpage. ----snip-----snip----- Hessian Selected Trim - First Trim Selected = Trim - Second Trim Selected = Hessian Selected Twotone - First Tone Selected = Linen Selected One Colour - Colour Selected = #!/usr/bin/perl require("cgi-lib.pl"); &ReadParse(*in); print &PrintHeader; $hatstyle="$in{'hatstyle'}"; $order="$in{'order'}"; $size_ladies="$in{'size_ladies'}"; $size_child="$in{'size_child'}"; $size_infant="$in{'size_infant'}"; $hessian_colour="$in{'hessian_colour'}"; $h_colouronly="$in{'h_colouronly'}"; $h_trim_one="$in{'h_trim_one'}"; $h_trim_two="$in{'h_trim_two'}"; $h_tone_one="$in{'h_tone_one'}"; $h_tone_two="$in{'h_tone_two'}"; $linen_colour="$in{'linen_colour'}"; $l_colour="$in{'l_colour'}"; $l_trim_one="$in{'l_trim_one'}"; $l_tone_one="$in{'l_tone_one'}"; $decoration="$in{'decoration'}"; $d_bow="$in{'d_bow'}"; $d_rose="$in{'d_rose'}"; $d_doublebow="$in{'d_doublebow'}"; $comments="$in{'comments'}"; print << `EOC`; if [ $hessian_colour="onecolour" ]; then echo "Hessian Selected" >> /home/httpsd/temp/countryhats echo "One Colour - Colour Selected = $h_colouronly" >> /home/httpsd/temp/countryhats fi if [ $hessian_colour="trim" ]; then echo "" >> /home/httpsd/temp/countryhats | echo "" >> /home/httpsd/temp/countryhats echo "Hessian Selected" >> /home/httpsd/temp/countryhats echo "Trim - First Trim Selected = $h_trim_one" >> /home/httpsd/temp/countryhats echo "Trim - Second Trim Selected = $h_trim_two" >> /home/httpsd/temp/countryhats fi if [ $hessian_colour="twotone" ]; then echo "Hessian Selected" >> /home/httpsd/temp/countryhats echo "Twotone - First Tone Selected = $h_tone_one" >> /home/httpsd/temp/countryhats echo "Twotone - First Tone Selected = $h_tone_two" >> /home/httpsd/temp/country fi if [ $linen_colour="onecolour" ]; then echo "Linen Selected" >> /home/httpsd/temp/countryhats echo "One Colour - Colour Selected = $l_colour" >> /home/httpsd/temp/countryhats fi