Dyn var use in Forms Proc. Loop

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Tried to build a dynamic var, check for empty data from the form.
If this can't be used, I guess I'll have to find a basic PHP forms
tutorial.  I'm trying to build an "insert" stmt.  Any suggestions ?

my code:
import_request_variables("gp", "v_");  
// $sql_text = "insert mtxt05 set id=3, comm=$v_comm, link1=$v_link1,
link2=$v_link2";  // prone with errors due to empty, etc.

// better way ?   originally a parse error, this might work now
$arrtxt = array( "comm", "link1", "link2" );
$sql_text = "insert mtxt05 set id=3, ";
foreach ($arrtxt as $val) {
   $sql_text .= empty($v_) ? "" : "$val=\"$v_\", ";

There's got to be a better way, than checking each and every form
variable for empty(), then concatonating a "fld=val" statement to a
sql statement.
I'm not sure I'm doing this right;  Please help - anyone with more

Site Timeline