The likely cause is that gpio isn't in the PATH available in cron. Specify the full path to your gpio command, such as
getval="$(/sbin/gpio read 17)" Find out where it is on your system using which gpio.
I got bitten by this before because I tinker with embedded solutions a lot. If the script is more complex, I usually initialize PATH and LD_LIBRARY_PATH near the start to make things easier.