I want to look through my PHP $_POST variables and change anything that is "undefined" (because of how jQuery is sending it) to "" or at least " " so that when the email form is submitted it doesn’t say "undefined" wherever the value wasn’t filled out (optional fields).
Thanks!
I recommend you consider altering your javascript to handle the undefines better, BUT..
Here is a no loops approach to do it:
There is also the more typical approach of using a single loop like so:
Note: The
serialize+unserializeapproach is cool in that is does not use a loop, but the loop approach is probably slightly faster, especially when$_POSTis large.