Jump to content

Textarea form data will not display


rick.emmet

Recommended Posts

Hi Everyone,

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 version of the code (for the form):

 

<!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>

 

And here is a simplified version of the php code that processes the form:

 

<?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
?>

 

When I submit the form, the processing page displays the form again (this is slightly different than the original way i'm doing this) with the data dynamically placed in the form. This allows the user to edit the form. All the data is displayed except the textarea data, that text box remains empty (although the data can be seen in the page source code). Can anyone explain why this is happening and how to fix it? I'd like to know! I appreciate your time.

Cheers,

Rick

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.