I have an interface that users will view to see data that they are uploading to a site. I'm using echo statements to dump the form data (as $_SESSION variables) on the page, which works just fine in the “static” portion of the page. I want to allow the users to edit the data and so have a hidden form at the bottom of the page, where they can edit the form data.
Again, I'm using echo statements to in the form - value=“<?php echo $_SESSION['variable'] ?>” - to dump the values the user input. This works with every type of input except with a <textarea> field (its just blank). If I view the page source, I can see all the text that was entered in the text box (and passed as a session variable to the page, but it will not display. Here's a simplified verson the code (for the form):
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Page</title>
</head>
<body>
<form method="post" action="test_formView.php" name="form1" ID="form1" >
<label>Bake style</label>
<select name="Bstyle" id="Bstyle">
<option>Broil</option>
<option>High Temp</option>
<option>Medium Temp</option>
<option>Low Temp</option>
<option>Warm</option>
</select><br />
<label>Oven</label>
<input name="Oven" type="text" size="50" maxlength="80" /><br />
<label>Baking <br> Description</label>
<textarea name="description" cols="45" rows="5" id="description" ></textarea><br />
<label></label><input type="submit" name="userfile" value="Submit Info" />
</form>
</body>Code: Select all
<?php
// code here for header, ect.
// code to filter form data
// storing POST variables in the session variable array
$_SESSION['Bstyle'] = $_POST['Bstyle'];
$_SESSION['Oven'] = $_POST['Oven'];
$_SESSION['description'] = $_POST['description'];
// Show the user what the contents of the ad uploaded
?>
<form method="post" action="test_formView.php" name="form1" ID="form1" >
<label>Bake style</label>
<select name="Bstyle" id="Bstyle">
<option><?php echo $_SESSION['Bstyle'] ?></option>
<option>Broil</option>
<option>High Temp</option>
<option>Medium Temp</option>
<option>Low Temp</option>
<option>Warm</option>
</select><br />
<label>Oven</label>
<input name="Oven" type="text" size="50" maxlength="80" value="<?php echo $_SESSION['Oven'] ?>" /><br />
<label>Baking <br> Description</label>
<textarea name="description" cols="45" rows="5" id="description"
value="<?php echo $_SESSION['description'] ?>" ></textarea><br />
<label></label><input type="submit" name="userfile" value="Re-submit Info" />
</form>
<?php
// code here for footer
?>Cheers,
Rick