473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can is set value in html element using php?

sample code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $userID = html text box value like "uid".
  3. without using GET or POST method
  4. because that method refresh page.
  5.  
  6. my question is
  7. how can i set the value of html textbox name "uid"
  8. in the php variable $userid?
  9.  
  10. ?>
  11. <script>
  12. function fun()
  13. { alert("<?php echo($userid) ;?>") }
  14. </script>
  15. <input type="text" id="uid">
  16. <input type="button" id="ok" onclick="fun()">
Jul 26 '11 #1

✓ answered by Markus

PHP is executed before the content reaches the browser; it is a server-side language. If you just want to get the value of a textbox in the browser, javascript will do enable you to do that. I'll move this thread to the javascript forum so those guys can inform you how to do so.

2 7699
Markus
6,050 Expert 4TB
PHP is executed before the content reaches the browser; it is a server-side language. If you just want to get the value of a textbox in the browser, javascript will do enable you to do that. I'll move this thread to the javascript forum so those guys can inform you how to do so.
Jul 26 '11 #2
Rabbit
12,516 Expert Mod 8TB
All you have to do is change your javascript function slightly.
Expand|Select|Wrap|Line Numbers
  1. function fun() {
  2.    alert(document.getElementById("uid").Value)
  3. }
Jul 26 '11 #3

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

Similar topics

4
by: frankabel | last post by:
Hi all! I have the following xml file: " <items> <item>hi</item> <item>hello</item> </items> " and need to read all the content between <items> and </items> tags and saved in a string, in...
2
by: AR | last post by:
Hi, How can I get strings separately which contain text nodes of a given element using XSL and XPath? For example, <a> aaa 111 <b>
1
by: Raghuram Banda | last post by:
Hi All, Can any one help me how to create a HIDDEN element using JavaScript (DOM) dynamically The following codes works fine with IE but not in Netscape currentElement =...
2
by: Gary | last post by:
Hi, I am developing desktop application. In the desktop application am loading a html page, i want to acces html element value from C# code. Can anyone help me? how to access a html element or...
3
by: Halo | last post by:
I have a HTML text box (NOT a TextBox server control) in a .aspx page and a button server control. Is it possible with ASP.NET to get the value of the HTML text box when I click the button? How...
6
by: Praveen | last post by:
As you all know the value of input, checkbox and other "user editable" elements can be retrieved on postback via Request.Params list, if you know their ID. However, if there is a span element...
5
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT...
1
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i...
2
by: dhillarun | last post by:
Hi All, I am passing ID of the HTML SELECT element to a javascript function. In that function I need to access the value selected in that select box. I tried the following code. but it didn't...
5
by: Edwin | last post by:
I am trying to write an application among which one of the functions is to determine the number of unique extensions found in a directory and all of its sub directories. I am trying to use Linq to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.