JavaScript to trigger PHP
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)?
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.
Yes. It's possible. Here's an example of the sort of technique you want.
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>
精彩评论