Re: Let me google that for you.
| From: | haliphax | Date: | Tue, 21 Apr 2009 14:25:02 +0000 |
| Subject: | Re: Let me google that for you. | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291740@lists.php.net to get a copy of this message | ||
On Fri, Apr 17, 2009 at 1:01 PM, 9el <lenin@phpxperts.net> wrote:
> If you play with jQuery its easy.
>
> And if you talk about JavaScript's urlencode functionality you wont ask
> about 'how to remove the + sign'
>
> I'm not very good yet on jQuery or else I would have shown you the codes.
jQuery doesn't make this much easier than vanilla Javascript in this
case. I don't see why JS is necessary at all, in fact.
search.html
===
<html>
<head><title>Search</title></head>
<body>
<form action="http://lmgtfy.com"
method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
</form>
</body>
</html>
No URLEncoding necessary, no JS, no PHP... just HTML. Were you to pass
pre-conceived search strings to it, it's as easy as this:
index.php
===
<?php
$s = 'search for this';
header('Location: http://lmgtfy.com?q=' .
urlencode($s));
?>
And you're done!
HTH,
--
// Todd