because i need to get the value of the textbox so that i could use it in my sql query..now, that;s my problem, i know its easy if i will just use a button for this..but i have problems with that, thats why, i took this as the solution.
it is probably best to put the text input inside a form and submit it. I'm not sure why you would have any problems using a submit button... but obviously submitting a form will cause a new page to load. Is that your problem - you can't have the page reload or go to another page?
that will submit the contents of the text box back to your server. "page.php" can be any page, even the one that contains the textbox if you code the php properly. To recall the textbox data in php use the $_POST[text1] variable.
Also, be sure to clean the data before adding it to a MySQL string using the mysql_real_unescape_string() function.
Unfortunately, it's now 4am where I live and I'm going to bed... so hopefully that helps. best of luck posting your data back to the server.
I can't see why you don't use a form button. That's what they're for. If you were using an ajax function to get certain info, like synchronising two dropdowns, fair enough, but it seems that you're actually navigating to a new page. For that you may as well use a submit button.
Like I said, the only way to pass information to php is with GET or POST and you probably want POST for user input from a textbox. The easiest way to POST is with a form. try this modified version of my previous code.
var output = "";
var elmtext1 = document.getElementById('text1');
output = elmtext1.value + "other stuff";
$input = $_POST[text1];
and you should also have this for security reasons to stop SQL injection attacks:
$input = mysql_real_escape_string($input);
IF you need to use Ajax, perhaps a js 'framework'/thingy like jQuery or Prototype would be useful. It takes care of the response object and simplifies post operations. I hate the idea of having to declare an IE ActiveX as well as the more straightforward XMLHttpRequest.