473,668 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can PHP control a form value directly

Ok. Can PHP control a form value directly? Eg. like the javascript
"document.Form1 .text01.value = "Y"". Eg. allow me to put a value into
a form text field on page load. Either I missed this in my PHP book
or the function does not exist.

The only way I have seen is to put code in the value part of the input
item, see below.

Thanks

<input type="text" value = "<? echo sprintf("%01.2f ",
$TotalCost);?>"/>
Sep 5 '05 #1
6 2489
David said the following on 05/09/2005 23:06:
Ok. Can PHP control a form value directly? Eg. like the javascript
"document.Form1 .text01.value = "Y"". Eg. allow me to put a value into
a form text field on page load. Either I missed this in my PHP book
or the function does not exist.
PHP is server-side, so it has no control of the form, other than the
HTML/Javascript/etc. that is sent to the browser.

The only way I have seen is to put code in the value part of the input
item, see below.
<input type="text" value = "<? echo sprintf("%01.2f ",
$TotalCost);?>"/>


So this (and variants) are the only way of doing this.

--
Oli
Sep 5 '05 #2
David (ma******@sbcgl obal.net) wrote:
: Ok. Can PHP control a form value directly? Eg. like the javascript
: "document.Form1 .text01.value = "Y"". Eg. allow me to put a value into
: a form text field on page load. Either I missed this in my PHP book
: or the function does not exist.

: The only way I have seen is to put code in the value part of the input
: item, see below.

: Thanks

: <input type="text" value = "<? echo sprintf("%01.2f ",
: $TotalCost);?>"/>

Normally php is simply generating text to send to the browser, so yes,
normally the above is exactly what you have to do (give or take the choice
of php commands to use).

If you use a template system to generate your output then there may be a
technique provided by the template system to set a value. In that case
you create and populate your template and then send the template, as a
long text string, to the browser. Whether the template control language
looks similarly to Javascript will depend on the template system.

One special case of a template system is to use something like an xml
builder library. Your php program can build an xml data structure in
memory. That DOM can be manipulated all you like. When it is ready you
send a stringified version of the DOM to the brower.

In no case, however, you are ever manipulating the value on the browser
like javascript would. All you can ever do is prepare a finished version
of the html text (including what ever values you wish) and then you send
that finished text to the browser.

Well actually, if you run a Java applet on the browser then the server may
have the ability to communicate directly with the values being displayed,
but that is a whole other kettle of coffee, and I have no idea what (if
any) php libraries would help you do that. (Not to mention that you would
probably need to write your own custom Java applet as well). I mention
this just for completeness, it is not something most web programmers will
ever do.

--

This programmer available for rent.
Sep 5 '05 #3
No.

That being said you could always remote with Flash or Processing or a
POJA.

Sep 6 '05 #4
Thanks for the info. I guess I have been having too much fun with
ASP.net, which allows direct asp forms access.

Need to shift back to the php mindset!
On Mon, 05 Sep 2005 22:45:53 GMT, Oli Filth <ca***@olifilth .co.uk>
wrote:
David said the following on 05/09/2005 23:06:
Ok. Can PHP control a form value directly? Eg. like the javascript
"document.Form1 .text01.value = "Y"". Eg. allow me to put a value into
a form text field on page load. Either I missed this in my PHP book
or the function does not exist.


Sep 8 '05 #5
I noticed that Message-ID: <j6************ *************** *****@4ax.com>
from David contained the following:
Thanks for the info. I guess I have been having too much fun with
ASP.net, which allows direct asp forms access.


Yebbut, it uses Javascript to do it!

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Sep 8 '05 #6
Geoff Berrow <bl******@ckdog .co.uk> wrote:
I noticed that Message-ID: <j6************ *************** *****@4ax.com>
from David contained the following:
Thanks for the info. I guess I have been having too much fun with
ASP.net, which allows direct asp forms access.


Yebbut, it uses Javascript to do it!


Exactly. I've sometimes wondered how many ASP.NET programmers realize that
their simple forms code is generating hordes of Javascript, and that many
seemingly simple user interface actions require rather expensive round
trips.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Sep 10 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3398
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
2
3619
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
9
2883
by: TCORDON | last post by:
I have a user control that contains 2 image buttons, when you click one of them, both must change the image source, the thing is that the first time you click any one of them the page appears to do a postbak, but the image source or the image displayed does not change until I click one of the images a second time, why dows it take 2 clicks for the user to "refresh"? TIA!
0
5561
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the administrators of the jobs can always receive the latest control). The property grid is used to...
6
4065
by: evandelagrammaticas | last post by:
Hi all. I have spent the better part of a day scouring the newsgroups and I am sure that I must have come across the solution a number of times - but I am still a real newbie at asp.net so please forgive me beforehand if I ask anything really simple or ridiculous. I am going to simplify my query... the structure of my example is ---> page1.aspx ------> page1.aspx.vb --->control1.ascx for the sake of simplicity this is what I am trying...
17
479
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? ----------------------------------------------------------------------- In HTML documents, named forms may be referred to as named properties of the « document.forms » collection, and named form controls may be referred to as named properties of the form's elements collection: var frm = document.forms;
7
12299
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm thinking the Table will stay open otherwise ??? - Do I also need to use code to Assign the Child&Master Links, or can I just type the names into the subForms Control Property and just depend on the SourceObject to link to Table???
4
2479
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
3
5259
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
8382
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8586
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.