I want a simple form with one text box and a submit button. For example: If a user enters "foobar" into the text box and hits enter, they should be redirected to mysite.com/browse/foobar
Does anyone know how I can do this in php? thanks
I want a simple form with one text box and a submit button. For example: If a user enters "foobar" into the text box and hits enter, they should be redirected to mysite.com/browse/foobar
Does anyone know how I can do this in php? thanks
Assuming name='q'
for the text input
<?php
if ($_GET['q'] === "foobar") {
header("Location: http://example.com/browse/foobar");
}
?>
The Form:
<form action="index.php" method="get">
<input type="text" name="q" />
<input type="submit" />
</form>
index.php
header("Location: http://example.com/browse/".$_GET['q']);
Note: this is not good practice but it works.