Page 1 of 1
Setting values of HTML objects
Posted: Mon Aug 13, 2007 11:22 am
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!
Posted: Mon Aug 13, 2007 11:25 am
by feyd
Yes, it can be set by PHP.
Posted: Mon Aug 13, 2007 11:25 am
by Zoxive
?
Code: Select all
echo '<input type="text" name="Textfld_name" id="Textfld_id" />';
Posted: Mon Aug 13, 2007 11:30 am
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.
Posted: Mon Aug 13, 2007 11:34 am
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.
Posted: Mon Aug 13, 2007 11:35 am
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.