Can we have control over what we send in a form data?

Can we have control over what we send in a form data?

I want to do a thing with $_GET[‘search’] URL variables, so,


<form name="index.php" method="get"> 
<input type="text" size="30px" name="search" value="" /> 
<input type="submit" value="Submit" /> 
</form>

This will send data to the url variables
and o index.php, I can get the URL Variable (search) to work with it.
Everything was working fine.

But today I seen an error when I searched http://www.google.com (which is with http://).

Suddenly I came to the error page that this page doesn’t exist.
How it could be possible.
How to make everything searchable including http://

Note: If you have not understood what I want to do, then in short, I want something like this,

[B]http://www.localhost.com/?s=http://www.google.com[/B]
But I am getting error in this, but
[B]http://www.localhost.com/?s=www.google.com[/B]
this works fine.

Example In HTML, I want to something like,


<form name="index.php" method="get"> 
<input type="text" size="30px" name="search" value="<?php str_replace('http://', '', $value_entered_by_user); ?>" /> 
<input type="submit" value="Submit" /> 
</form>

Thanks.

Why is your form name index.php? That should be action me thinks.

Where did localhost.com/?s come from? The field is named ‘search’ so I’d expect the request to go to localhost.com/?search, unless your script is redirecting you there? In which case you may need to [fphp]urlencode[/fphp] the value.

The default for forms is urlencoded - no additional code should be needed to set it to that. You could always try adding an enctype= to the form tag though to see if changing that makes any difference.

[COLOR=#009900][COLOR=#000066]<form name=“index.php” method=“get”>

you haven’t specified where the form data is to be sent to.


[/COLOR][/COLOR]