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

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

Postby sbglobal123 » Mon Oct 10, 2011 12:11 am

Can I use a variable from a .php file to give a value to an HTML FormMail form field thus: ?



plz ans me.
sbglobal123
 
Posts: 1
Joined: Mon Oct 10, 2011 12:06 am

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

Postby mattm948 » Mon Oct 17, 2011 8:56 pm

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 "} />
mattm948
CWH Staff
 
Posts: 45
Joined: Mon May 17, 2010 5:02 pm

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

Postby markwillson400 » Mon Apr 15, 2013 10:00 am

yes, you can use a variable from a .php file to give a value...
markwillson400
 
Posts: 3
Joined: Sat Mar 23, 2013 8:58 am
Location: India

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

Postby Brainscott » Fri Aug 08, 2014 5:09 am

If we change the variable, does the value will also change..??
Brainscott
 
Posts: 1
Joined: Fri Aug 08, 2014 4:57 am

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

Postby kristopher.smith » Mon Sep 15, 2014 12:43 pm

Here the variable is emailaddress.
Hence for different values of variable email address , the 'value' field will change. :)
Cheers,
Kristopher
Canadian Web Hosting
kristopher.smith
 
Posts: 1
Joined: Wed Jun 25, 2014 4:18 pm


Return to PHP

Who is online

Users browsing this forum: No registered users and 3 guests

cron