I want to get the value of textbox to php variable in the same page. Is there any way to do this?
<input type="text" name="Stdgrade" id="Stdgrade" value="6" />
I want to get the value of textbox to php variable in the same page. Is there any way to do this?
|
|||||||||||||||||||||
closed as not a real question by Your Common Sense, TJHeuvel, code_burgar, Gordon♦, Toon Krijthe Nov 11 '11 at 10:00It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||||||||||||||
|
works for me ;) in the putYourPHPfileHere.php you can retrieve the value by
|
|||
|
You need to wrap in in a form element and post it to the page on your webserver. In that page you can retrieve the valie from the $_POST array, like $_POST['Stdgrade']. All of this is pretty basic stuff, so I think you might want to do some tutorials on this first. Example form:
If you want to do this through an AJAX api (looking at the tags you added), you might want to take a look at the jQuery AJAX method. But your question is way to vague to help you more on this. |
|||
|
you have to post the value to the same page. Then you have to get the value from the request like:
|
|||
|
Yes, and the input must be within the form that causes request |
|||
|
Since PHP is run server side this is not possible. You would have to submit the form and retrieve the variable on the next page load. |
|||
|
This will postback your value to a php variable, which will then be shown on screen:
|
|||
|