By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

how do I send value of textbox without using form tag and submit button

P: 107
I want to send value of textbox without using form tag and submit button to another page? Is it possible with php ?
How do I get this thing work?
thanks alot
Mar 8 '09 #1
Share this Question
Share on Google+
5 Replies

Expert 5K+
P: 6,050
PHP does not interact directly with the browser. You'll need to use javascript to obtain the value of the textbox and then append it to the url (mimic GET).

I don't understand why you cannot use a form - they're there for the purpose of passing data to pages.
Mar 8 '09 #2

Expert 100+
P: 1,168
Is it just to the following page? How does the user move to the next page? Seeing as you are not using a form (no $_POST), you have to use $_GET, as has already been said. I guess you could probably use AJAX to save the data in a database somehow so it can be called as a session variable on the next page, but using a form would be heaps easier!
Mar 8 '09 #3

P: 107
thing that I want to do this is after write in textbox and without click button
value of textbox is send to next page without this value is added to url
I want to do this work with php and javascript without ajax
Is this possible?
thanks lot
Mar 10 '09 #4

Expert Mod 5K+
P: 8,639
in simple words: no.
Mar 10 '09 #5

Expert 100+
P: 1,168
To elborate on Dormilich's reply:
PHP is server side, as in once the page has been sent to the browser from the server, PHP is useless and has no control. PHP can process forms, use variables etc...
Javascript is the opposite. It only works once the page is sent and is entirely reliant on the browser. It can be used to auto fill forms and even submit forms for you. Because it is browser dependant, if your visitor has turned off javascript, is will not work at all.
AJAX is between these forms, so it can auto submit forms, process variables etc... It's simply an extension of javascript, so if you know javascript, AJAX isn't that much more work.

As I said, it is possible to submit forms on events, but it will require some user input like click a button or mousin/mouseout. Use google to find out how to submit forms with javascript to get an idea.

If you explain why you have all these restrictions we can tell you better ways to do it, because often there is a simpler way... Which we can only reveal if we know the problem.
Mar 10 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.