Simple text on google.com

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Simple text on google.com

Post by kapil1089theking »

Code: Select all

 
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<form name="form1" method="post" action="">
  <input type="text" name="textfield">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
 
 


When I press Submit, I want to get the text from text field and open http://www.google.com with text field content as this page's text.
How to do that?
Last edited by kapil1089theking on Sun Jan 10, 2010 9:38 am, edited 1 time in total.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Simple text on google.com

Post by jayshields »

As far as I'm aware, you can't.

You can however make your submit button emulate Google's submit button as if the text was in their text box?

http://www.google.com/search?q=your+text
agriz
Forum Contributor
Posts: 106
Joined: Sun Nov 23, 2008 9:29 pm

Re: Simple text on google.com

Post by agriz »

Code: Select all

<html> 
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
<script type="text/javascript">
function doGoogle()
{
    val = document.forms[0].q.value;
    document.forms[0].action = 'http://www.google.com/search?q='+val;
    document.forms[0].target = "_blank";
}
</script>
 
</head>
 
<body>
<form name="form1" method="get">
  <input type="text" name="q">
  <input type="submit" name="btnG" value="Google Search" onClick="doGoogle()">
</form>
</body>
</html>
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Re: Simple text on google.com

Post by kapil1089theking »

what if i want to get this value from 1st form to first name of http://www.magicjack.com/8/step2.asp

I am unable to do the same
Post Reply