Is it possible to have an input text box such that when a person types something and presses submit or enter, I can trigger PHP to submit that data to a database without leaving the page (hence the JavaScript)?
12
-
2Read up on jQuery, spelling, and grammar.Josh K– Josh K2010-07-12 04:26:50 +00:00Commented Jul 12, 2010 at 4:26
-
3+1, not sure why you were getting -1 votes - this is an honest question from somebody who just needs to entry level ajax help.Matthew J Morrison– Matthew J Morrison2010-07-12 04:29:12 +00:00Commented Jul 12, 2010 at 4:29
-
2@Matthew: you probably got -1 (-2 now) because of the lazy spelling and grammar. English as a second language is one thing, but that doesn't seem to apply here.Dean Harding– Dean Harding2010-07-12 04:30:05 +00:00Commented Jul 12, 2010 at 4:30
-
6@Matthew: I translate your comment as "I don't have enough respect for you to pay attention to how I communicate."Michael Petrotta– Michael Petrotta2010-07-12 04:35:05 +00:00Commented Jul 12, 2010 at 4:35
-
2@Matthew Then why are you asking us for help? If you don't respect us enough to pay attention to how you communicate, then how is it you respect us enough to want our opinion(s)?Kalium– Kalium2010-07-12 04:41:21 +00:00Commented Jul 12, 2010 at 4:41
|
Show 7 more comments
3 Answers
You're going to want to look into something called AJAX. I won't add any code here because there are thousands of excellent tutorials out there that will be much more thorough than I can type here. I would recommend using the jQuery Javascript library to help out.
1 Comment
DonJuma
Thanks again i just saw a tutorial on W3C and its kinda easy
You can do this by using a <form> tag with you textbox and submit button inside.
<form name="input" action="do_something.php" method="get">
<input type="text" name="Value" />
<input type="submit" value="Submit" />
</form>
2 Comments
Matthew J Morrison
This isn't what he's asking for - he said, "without leaving the page".
Adam P
Oops. Guess I should read the question more carefully next time.