Page 1 of 1

Can I use a variable from a .php file to give a value to an?

PostPosted: Mon Oct 10, 2011 12:11 am
by sbglobal123
Can I use a variable from a .php file to give a value to an HTML FormMail form field thus: ?



plz ans me.

Re: Can I use a variable from a .php file to give a value to

PostPosted: Mon Oct 17, 2011 8:56 pm
by mattm948
Yes *, you can use a variable from .php file and put it in html form field.

Example :

PHP File
===================================================================================================

<?php

$emailAddress = "info@sales.com" ;

?>

===================================================================================================


HTML/PHP File

===================================================================================================
<html>
<head>
</head>
<body>
<form>

<input type="text" name="email_field" size="30" value="<?php echo $emailAddress ; ?>" />

</form>
</body>
</html>
===================================================================================================


* Note however that there are PHP files called Templates or those with .TPL extensions. Putting in PHP variables within these files have a different method. It depends on the Templates that you are using. Usually you put the php variable in curly brackets like. Some templates won't allow this to work at all.

<input type="text" name="email_field" size="30" value="{ emailAddress "} />

Re: Can I use a variable from a .php file to give a value to

PostPosted: Mon Apr 15, 2013 10:00 am
by markwillson400
yes, you can use a variable from a .php file to give a value...

Re: Can I use a variable from a .php file to give a value to

PostPosted: Fri Aug 08, 2014 5:09 am
by Brainscott
If we change the variable, does the value will also change..??

Re: Can I use a variable from a .php file to give a value to

PostPosted: Mon Sep 15, 2014 12:43 pm
by kristopher.smith
Here the variable is emailaddress.
Hence for different values of variable email address , the 'value' field will change. :)