So basically I have siteground hosting my website, and wordpress for building the website. On the home page of the website I have a php code snippet plugin that lets me put php code. The php code there is a typical html form with a input of type select, which lets you choose a product from a dropdown menu. After choosing and clicking the submit button, the forms action is a filterReceive.php file in the root directory of the website.
Once the form submits to filterReceive.php, I have code that takes in the product that the user chose from the dropdown list, and according to the product i want it to redirect the user to that products page.
Below is my code for redirecting the user to the page:
<?php
if (isset($_REQUEST["submit-button"])){
$product = $_GET['product'];
if($product == "fridge"){
echo "entered function";//this text shows up when the filterReceive.php loads up, so the header function below should also execute
header ("Location: https://www.ebay.com/");//this header function dosent execute no matter what, even if i use relative file in the directory
exit();
}
}
?>
Any help would be greatly appreciated, Im just trying to build simple php code that would redirect a customer to the correct product page after they selected the product from the drop down list and clicked submit. If there are any similar ideas or plugins for wordpress done elsewhere, a link would be super helpful. Thank you all very much!