Adding $_GET submission to header content redirect?

Here is what I’ve got at the moment. It is not working. How do I go about this?

if (isset ($_GET['category']))  {
	
	$category = $_GET['category'];
	$keyword = $_GET['keyword'];
	
		if (
		($category == 'news') ||
		($category == 'blog') ||
		($category == 'articles')
			)
				
				{	
					try {
						$sql = 'Select * from blog where ((title LIKE :keyword) OR (body LIKE :keyword))
													 AND type LIKE :category';
						$results = $pdo->prepare($sql);
						$results->bindValue(':keyword', '%' . $keyword . '%');
						$results->bindValue(':category', '%' . $category . '%');
						$results->execute();
						$items = $results -> fetchAll (PDO::FETCH_OBJ);
						}
						
						catch (PDOException $e) {
							echo 'Error'. $e->getMessage();
							}
					}
					
					if ($category == 'videos'){
								header("Location: /search-videos.php?keyword='$keyword'");
								}
	
	}

Try this

header("Location: /search-videos.php?keyword=" . $keyword);
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.