I want to redirect to other page based on the selected string in combo box.
I have added following code:
switch ($downloadType){
case "text1":
header("Location:pdf/text1.pdf");
break;
case "text2":
header("Location:pdf/text2.pdf");
case "text3":
header("Location:pdf/text3.pdf");
default:
header("Location:index.html");
}
But this simple script is not working. I am new to php. Do you have any idea why I am not able to change header. Is it like we cannot change header using switch-case statements.
If this is not the way then what could be the possible way to redirect to another page on form submission.
You need to add a break; to the end of each case.