Your $sqlkeyword in foreeach will return only last value. because you put your mysql_query outside foreach.
You can use this method to run mysql_query for every foreach keyword
$keywords = "Design~!~Development~!~Print";
$keywordsplit = explode('~!~',$keywords);
foreach($keywordsplit as $keysplit) {
$sqlkeyword = "INSERT INTO keywords (keyword) VALUES ('".mysql_real_escape_string($keysplit)."')";
$keywordtest = mysql_query( $sqlkeyword, $conn );
}
or this method to save the foreach keyword as array
$keywords = "Design~!~Development~!~Print";
$keywordsplit = explode('~!~',$keywords);
$arraykeyword = array();
foreach($keywordsplit as $keysplit) {
$arraykeyword[] = "('".mysql_real_escape_string($keysplit)."')";
}
$sqlkeyword = "INSERT INTO keywords (keyword) VALUES " . implode( ',', $arraykeyword);
$keywordtest = mysql_query( $sqlkeyword, $conn );
First method look simple but will consume more memory than second method
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which.