Display PHP Array Value Inside HTML Form Text Box

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
jackponte
Forum Newbie
Posts: 11
Joined: Thu Feb 04, 2010 5:04 pm

Display PHP Array Value Inside HTML Form Text Box

Post by jackponte »

Hi,
I'm new to PHP and MySQL but so far so good trying to get done what I need to do. I seem to get stuck displaying an array value inside a form text box. This is what I have but it does not work. I actually see the code inside the box:

Code: Select all

<input name="custID" type="text" size="45" VALUE="<? echo $info['Cust_ID']; ?>"
My echos and prints work fine. But I would like the data inside the text box to be modified if any.

Code: Select all

echo $info['Password'];
print $info["Username"];
I've try adding the PHP tags but I gte an error: Parse error: syntax error, unexpected '<' in C:\Documents and Settings\jack.ponte\Desktop\Website\form1.php on line 258.

Code: Select all

<td width="274"><?php <input name="ShipAttention" type="text" size="45" VALUE="<? echo $info['Cust_ID'] ?>"> ?> </td>
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: Display PHP Array Value Inside HTML Form Text Box

Post by emmbec »

jackponte wrote:

Code: Select all

<td width="274"><?php <input name="ShipAttention" type="text" size="45" VALUE="<? echo $info['Cust_ID'] ?>"> ?> </td>
you have an extra <?php tag before the input...and one ?> at the end... remove those and it should work fine.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Display PHP Array Value Inside HTML Form Text Box

Post by AbraCadaver »

Yes, and don't use <? use <?php instead.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply