Content of an input in HREF

0

How do I get the person redirected to a URL + what do they type?

Example

The person types potato in the input below

<input type="text" name="search" id="search">

And when you press enter it is redirected to

www.google.com/search?q= potato

    
asked by anonymous 24.09.2016 / 22:48

1 answer

1

I do not know if you really need to use PHP to do what you want! If it's just a field! You can use a form with method="get"

But if you do not want to do this, just capture the value of the input, add the value to a variable and insert into a URL, and do a redirection with the PHP header

<?php header("Location: http://www.site_a_ser_redirecionado.com/search=".$variavel.""); ?>
    
24.09.2016 / 23:04