Fakhr Alam Fakhr Alam - 2 years ago 105
PHP Question

displaying cookie value inside textbox

i have to display a cookie value in textbox

but the value is surrounded with a lot of space on both sides

i am appying trim() but still not fixing

< ? php
{ $uName=trim($_COOKIE["uName"]);}
<input type="text" name="uName" value="<?php echo $uName; ?>">

Answer Source

I have solved it.
Error was here

<input type="text" value="<?php echo $_COOKIE["uName"]; ?>">

Now i have replaced this with

<input type="text" <?php echo "value='".$_COOKIE["uName"]."'"; ?> >

It's working fine now.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download