Page 1 of 1

Display PHP Array Value Inside HTML Form Text Box

Posted: Wed Feb 17, 2010 1:43 pm
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>

Re: Display PHP Array Value Inside HTML Form Text Box

Posted: Wed Feb 17, 2010 1:47 pm
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.

Re: Display PHP Array Value Inside HTML Form Text Box

Posted: Wed Feb 17, 2010 3:34 pm
by AbraCadaver
Yes, and don't use <? use <?php instead.