Getting info from an optional form field
Posted: Thu Nov 17, 2011 1:28 pm
This is likely a basic question, but I want to get information from a form field that the user does not have to fill out.
$optional = ($_POST['optionalfield']);
I get an error "Undefined Index: optional"
This is probably because there is no value to field. What is the best way of handling this? I will put this into a mysql database, and I will be keeping track of statistics, so putting in placeholder value by initializing the variable beforehand didn't seem like the right thing to do.
$optional = ($_POST['optionalfield']);
I get an error "Undefined Index: optional"
This is probably because there is no value to field. What is the best way of handling this? I will put this into a mysql database, and I will be keeping track of statistics, so putting in placeholder value by initializing the variable beforehand didn't seem like the right thing to do.