Setting values of HTML objects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
canadiancoder
Forum Newbie
Posts: 6
Joined: Tue Aug 07, 2007 8:35 am

Setting values of HTML objects

Post by canadiancoder »

Hi Folks,

Suppose I have a text field on an HTML page and for simplicity let the ID = "text_field". I am wondering if I could set the value of that text field using PHP. I know how to GET the data but setting it still eludes me.

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Yes, it can be set by PHP.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

?

Code: Select all

echo '<input type="text" name="Textfld_name" id="Textfld_id" />';
canadiancoder
Forum Newbie
Posts: 6
Joined: Tue Aug 07, 2007 8:35 am

Post by canadiancoder »

Thanks for the tip but it's a little more complex than that. You see I have a number of dynamic forms that are generated using JavaScript. In essence the user can select an option from a drop down menu and that would generate the associated form. I would like to set the values in such a way that when it is generated by my JS function the proper data will populate the form.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

canadiancoder wrote:I would like to set the values in such a way that when it is generated by my JS function the proper data will populate the form.
Then you'll need to use AJAX if the values only exist server-side.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

javascript: client-side
php: server-side.
If you have a javascript function hat created the form without sending a http request to the server, then php is not involved at all.
Post Reply