Hi andym67 and welcome to DaniWeb :)
A better approach is this:
if(isset($_SESSION["namevalue"]))
$val = $_SESSION["namevalue"];
else
$val = "";
// maybe do some validation on $val here
echo "<input name='fname' type='text' class='textfield' id='fname' value='$val' />";
or:
<?php
if(isset($_SESSION["namevalue"]))
$val = $_SESSION["namevalue"];
else
$val = "";
// maybe do some validation on $val here
?>
<input name="fname" type="text" class="textfield" id="fname" value="<?php echo $val; ?>" />;
darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
Agree with Xan's code fix
embedding php inside html, it is important to get all the quotes in.
only add a usefula(maybe) caveat to the code he provided, a recommendation to change whatever editor used to something that code highlights
It becomes easy to see when something is missing if the text is some bright colour when a(the) quote(s) Brace(s) Bracket(s) < > is(are) missing
Notepad++ Notepad2 & a bunch of good code highlighting editors
without the quotes output html for a nul field is value= /> your visble backslash
with quotes a nul gives value="" />
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376