Page 1 of 1

Using PHP to update a form label

Posted: Tue Mar 09, 2010 3:52 pm
by JackD

Code: Select all

 
<form>
<label id="CustInfo">xxxx</label>
<label for "dollarvalue" style="display:block">Store Points:</label>
<input  id="DollarValue" type="text" name="dollarvalue" size="12" />
</form>
 
In the above form, is it possible using php, to update the <label id="CustInfo" "xxx" value to be "George Jones" and insert the text "$12.00" into the textbox for <input id="DollarValue"... ?

Re: Using PHP to update a form label

Posted: Tue Mar 09, 2010 3:59 pm
by cpetercarter
Presumably, you want these changes to be made after the webpage has been sent to the browser (eg in response to some user action like clicking a button). Normally, Javascript is used for this purpose.

Re: Using PHP to update a form label

Posted: Tue Mar 09, 2010 4:00 pm
by AbraCadaver

Code: Select all

<?php
$info = 'George Jones';
$value = '$12.00';
?>
<form>
<label id="CustInfo"><?php echo $info; ?></label>
<label for "dollarvalue" style="display:block">Store Points:</label>
<input  id="DollarValue" type="text" name="dollarvalue" value="<?php echo $value; ?>" size="12" />
</form>

Re: Using PHP to update a form label

Posted: Tue Mar 09, 2010 4:09 pm
by JackD
Thanks to both of you. I was afraid we would have to use JavaScript, but thought perhaps it might be possible to get the server to update the page without reloading it.