I have a search form and if I use it like this:
<form method="post" action="search.php?go">
<input type="text" name="name">
<input type="submit" name="search" value="Search">
</form>
It works.
If I try to use it like this, then it doesn't:
<?php
if ($_POST['submit'] == 'search') {
header("Location:search.php?go");
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method="post" action="">
<input type="text" name="name">
<input type="submit" name="search" value="Search">
</form>
I need two forms (the search and a dropdown menu) on my site and if I use simple "action" with the pages to call, then it doesn't work, so I try to do it with PHP.
I find only this "Header:location" method on the net, but it doesn't work for me.
EDIT: I solved this in another way without redirect, because I couldn't get it work even with session variables.