Fakhr Alam Fakhr Alam - 1 year ago 76
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.