diff --git a/modules/tv/set_channels.php b/modules/tv/set_channels.php
index 6db27da..c77f697 100644
--- a/modules/tv/set_channels.php
+++ b/modules/tv/set_channels.php
@@ -46,15 +46,15 @@
             // next, the fields that need to have a value, so we won't change them if they were emptied
                 if ($data['channum']) {
                     $query         .= ',channum=?';
-                    $query_params[] = $data['channum'];
+                    $query_params[] = trim($data['channum']);
                 }
                 if ($data['callsign']) {
                     $query         .= ',callsign=?';
-                    $query_params[] = $data['callsign'];
+                    $query_params[] = trim($data['callsign']);
                 }
                 if ($data['name']) {
                     $query         .= ',name=?';
-                    $query_params[] = $data['name'];
+                    $query_params[] = trim($data['name']);
                 }
                 $db->query($query.' WHERE chanid=?',
                            $query_params,
