Hello. I have this code:
$labels = explode(",", $_POST['labels']);
foreach($labels as $val) {
$val = trim($val);
mysql_query("INSERT INTO TABLENAME (name, cat_id) VALUES ('".mysql_real_escape_string($val)."', '$cat')");
}
As you understood it user's labels function. Every label inserted separately (separated by comma).
I want to check if last character in the input form of labels is dot- so user means that this is the end of his list of labels. So how do i check in such construction the last character and if it's a dot - remove?
$labels = explode(",", $_POST['labels']);
foreach($labels as $val) {
$val = trim($val);
mysql_query("INSERT INTO TABLENAME (name, cat_id) VALUES ('".mysql_real_escape_string($val)."', '$cat')");
}
As you understood it user's labels function. Every label inserted separately (separated by comma).
I want to check if last character in the input form of labels is dot- so user means that this is the end of his list of labels. So how do i check in such construction the last character and if it's a dot - remove?