Contents

 
Home
PHPRunner 6.1 manual
Prev Page Next Page
 
 

Select multiple values from checkboxes or a list field and have them appear as individual database entries

 

To select multiple values from check boxes or a list field and have them appear as individual database entries use the following code in Add page: Before Record Added event.

yellowbulbNote: Change the values listed in red to match your specific needs.

global $conn;

if ($values["fieldname"])

{

 $arr = explode(",",$values["fieldname"]);

 // This is the name of the multi check box or

 // list select field, its value becomes $arr

for ($i=0;$i<count($arr);$i++)

{

 $strInsert = "insert into TableName (field) values ('".$arr[$i]."')";

 // add more fields from the add page to be inserted into database

 

 db_exec($strInsert,$conn);

}

header("Location: MyPage_list.php");

 // Exit and Redirect to the list page after updating database

exit();

}

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)